2
var maskWidth = $(window).width();
alert(maskWidth);

I get 1263 from chrome and firefox (which is 1280 in fact, but with scroll it write a less value). IE print 1259.

How can I fix this problems with JQuery?

2 Answers 2

4

This isn't a problem with jQuery, it is returning the value of the displayable portion of your website.

You need to be looking at .innerWidth() here which will return results closer to which you require.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. But : This method is not applicable to window and document objects; for these, use .width() instead.
1
$.clientCoords = function(){
    if(jQuery.browser.msie){
        return {
            w:document.documentElement.offsetWidth,
            h:document.documentElement.offsetHeight
        }
    }
    else
        return {w:window.innerWidth, h:window.innerHeight}
}

This function returns the height and weight of browser or current window

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.