i have problem following jquery function:
$(document).ready(function(){ $(window).scroll(function(){ if ($(window).scrolltop() + $(window).height() == $(document).height()) { $('.scrolltotop').fadeout(); } else { $('.scrolltotop').fadein(); } }); $('.scrolltotop').click(function(){ $('html, body').animate({scrolltop : 0},800); return false; }); }); this function display div when user scrolls down page. problem is, div displayed when page loaded , window on top! when scrolling down div stays. when clicking div window scrolls , div disappears should do. problem appears after loading page.
so have no clue causes that?
thanks alot.
just add fadeout or hide initially. should it.
$(document).ready(function(){ $('.scrolltotop').hide(); $(window).scroll(function(){ if ($(window).scrolltop() + $(window).height() == $(document).height()) { $('.scrolltotop').fadeout(); } else { $('.scrolltotop').fadein(); } }); $('.scrolltotop').click(function(){ $('html, body').animate({scrolltop : 0},800); return false; }); });
Comments
Post a Comment