0

I'm measuring the window and document width and height via the following properties :

//measure the window and document height and width dynamically    
var w = $(window).width();
var h = $(window).height();
var wd = $(document).width();
var hd = $(document).height();

Works fine in firefox but IE kicks up a fuss. Is there an alternative to this syntax that works in IE?
JS error recieved - could not get the position property. Invalid Argument

0

3 Answers 3

2

Works for me in both FF and IE, check for yourself here.

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

1 Comment

Same. Works in Chrome as well. My guess is the code that's actually failing is elsewhere.
1

i just figured out, whats the "bug" in the code. Firefox is able to get width and height, whereever you put your javascript. But IE is only able to get this values when the script is within the body element. I've had the same problem here and was trying about an hour. I noticed, that the jsbin script is inside the pagebody and moved my javascript into the body and wow - it works in IE :-)

Best regards

Comments

0

I had the same problem and i solve it.

The question was related with IE being in Quircks mode, because i had in the begining of the HTML some non valid tags (i copy the source from a .aspx page, and i left there the <%page ..%> directive.

When IE finds some strange tag it enters quircks mode, and some things work diferent.

When i deleted the strange tag, the $(window).width(); stuff begins to work.

Hope this helps someone in the future with my same problem. :)

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.