$(window). height() returns value equal to $(Document). height()

Asked

Viewed 246 times

1

I have a very annoying little problem.

I’m trying to get the "scrollBottom" from the page, using:

$(document).height() - ( $(this).scrollTop() + $(window).height() )

I then made a "tabelinha" to show the data on the screen, and tested on other sites (opening the site, and inserting my code in the browser console):

Exemplo da "tabela" em uma página do próprio SO

But it turns out on my website, $(window).height() is returning the height of the HTML page instead of the browser window:

"tabela" na minha página

The strange thing is that this occurs even though I have nothing in the script other than $(document).ready() or $(window).load(). But it doesn’t happen if you just have the $(window).height() ) (That way I don’t have the table, but the $(window).height() returns the correct value.

Com $(document).ready()Sem $(document).ready()

And create variables before the $(document).ready() or $(window).load() generates the following error:

inserir a descrição da imagem aqui

Does anyone there have any idea what this might be?

  • Can you make a jsFiddle with the code you have on the page? This error is a little strange.

  • It turns out that it is quite large, a full page The equivalent script, although the error should not be in the script, since even without any command, the error occurs

  • Well, I tried to copy the codes (HTMLS, CSS and JS) to jsFiddle But it’s not working, I think Javascript isn’t running It doesn’t give any alert, and Carrusel I did not run I’m not sure what to do there, I’m not familiar with this jsFiddle Anyway, here are the links: Collaboratition: https://jsfiddle.net/pk4kk8d8/#&togetherjs=H9f6vgqu7o Share: https://jsfiddle.net/pk4kk8d8/

  • Since for jsFiddle it was not working well, I sent it to jsbin: http://jsbin.com/tonewiculi/1/ It got a little twisted and lost some things, like images, but it’s the least & #Xa; http://jonatasamaral.comyr.com/sinharosa.com/

  • I tested picking up page sizes with pure Javascript, and it worked well. I created a bar overlaying the page, with each measure form: http://i.imgur.com/x4zDeDm.png the white part is the page size. So I noticed: window.innerWidth takes the size of the page with the scroll bar window.outerWidth takes the size of the entire janala of the browser Document.documentElement.clientWidth or Document.body.clientWidth take the internal size of the window window.width does not work

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.