Do not add the class via js what to do?

$(window).scroll(function() {
 if ($(this).scrollTop() > $(this).height()) {
$('.top-arrow').addClass('active');
 } else {
$('.top-arrow').removeClass('active');
}
 });


The class is not added, although the code is correct, what to do? :with
June 14th 19 at 20:31
1 answer
June 14th 19 at 20:33
Solution
Perhaps because the scroll does not reach values above the height of the window?
But alas no :C - Emma_Homenick commented on June 14th 19 at 20:36
, error no MB the script where he fell? - Elza.Altenwerth commented on June 14th 19 at 20:39
The console is clean, both on the LAN and on the host, there are errors but this is due to ulogin. it has not affected our scroll - Emma_Homenick commented on June 14th 19 at 20:42
put the output variables in the console each time best personal Finance, and say that displays - Elza.Altenwerth commented on June 14th 19 at 20:45
Will be glad if you tell me how js is not yet mastered properly.. - Emma_Homenick commented on June 14th 19 at 20:48
code
$(window).scroll(function() {
console.log($(this).height());
console.log($(this).scrollTop());
});
- Elza.Altenwerth commented on June 14th 19 at 20:51
empty konsolka.. - Emma_Homenick commented on June 14th 19 at 20:54
what I actually said, that error that you have it recessed this script, remove the errors and everything should work. - Elza.Altenwerth commented on June 14th 19 at 20:57
Error with ulogin? on LAN they are not, if the error is with height I will look for - Emma_Homenick commented on June 14th 19 at 21:00
well if you don't output anything to the console so the handler just does not work, he can not just not work) I have it on this site in the console ordered and it works - Elza.Altenwerth commented on June 14th 19 at 21:03
thanks , I will look for - Emma_Homenick commented on June 14th 19 at 21:06
Everything in the end nifiga :with - Emma_Homenick commented on June 14th 19 at 21:09

Find more questions by tags jQueryJavaScript