Reputation: 181
I'm unable to get a correct value when running $(window).height()
on www.presenskonferens.se. It's the same in all browsers.
Here's the code I'm using:
// Screen height sections
$(function() {
function screen_height() {
$('.screen-height').css({'height': $(window).height() });
}
screen_height();
window.addEventListener("orientationchange", screen_height );
$(window).resize( screen_height );
});
Here's what I've tried:
<!DOCTYPE html>
)$('.screen-height').css({'height': $(window).height() });
$(window).height()
and getting 12191 in returnI'm stumped. As far as I can tell, the error occurred when the site was updated to WordPress 4.0, but it isn't using the version of jQuery bundled in WordPress. Any and all help is appreciated.
Upvotes: 3
Views: 1691
Reputation: 1218
When the doctype isn't set correctly, jQuery treats $(window).height()
the same as $(document).height()
.
You have used the right doctype (<!DOCTYPE html>
) but by adding your analytics code before it, you've rendered it invalid.
Move your analytics code into the head, just before the closing </head>
tag and it should all work fine.
Edit: I've just noticed you've got two different analytics code blocks. Get rid of the one at the very top (on line 1).
Upvotes: 2