I'm creating dynamic posisition of tooltip, I have tested code on jsfiddle first before put my code to my site (build with wordpress on localhost), on jsfiddle my script is works but when I put code to my site, It's not works (not dynamically on chrome) because different result of $(window).height()
. You can check this fiddle and try to mouse enter to a link (first link) and then see log at console, the result of window height is wh :667
but on my site window height is wh :12024
and wh : 11970
(changeable)
jQuery(document).ready(function ($) {
$('a[rel="bookmark"]').mouseenter(function () {
console.log($(window).height());
})
});
also using this
jQuery(function($){
$(window).ready(function(){
console.log($(window).height());
});
$(window).on('resize', function(){
console.log($(window).height());
});
});
Google Chrome
jsfiddle : 667
my site (wordpress) : 12024 - changeable
Mozilla
jsfiddle : 602
my site : 585
I'm sure, I have added strict doctype.
I found this explanation
$(window).height()
is the height of the viewport that shows the website. (excluding your toolbars and status bar and stuff like this)
$(document).height()
is the height of your document shown in the viewport. If it is higher than$(window).height()
you get the scrollbars to scroll the document
I think on my site result $(window).height()
is scrollbars to scroll the document on chrome (fyi my site have a long page). If it is like that, how can I get height of the viewport on my site, is there another way to get same result (actual) height of the viewport every browser (chrome, mozilla, opera etc) ?
note : I don't think for use screen.height
because it can result display of screen (include toolbar of browser)