javascript - Item appearing when reaching a certain height (scroll effect) -
i found code :
script type="text/javascript">
$(document).ready(function() { $(window).scroll(function () { var height = $('body').height(); var scrolltop = $('body').scrolltop(); var opacity = 1; if(scrolltop > 400) { opacity = 0; } $('.social').css('opacity', opacity); }); });
although, i'd reverse these effects. i'd element start opactiy : 0 , fadein when reaching height (in case 400).
thanks
although i'm not sure if tried yourself, i'd say:
$(document).ready(function() { $(window).scroll(function () { var height = $('body').height(); var scrolltop = $('body').scrolltop(); var opacity = 0; if(scrolltop > 400) { opacity = 1; } $('.social').css('opacity', opacity); }); });
(not tested, i'm pretty confident that's looking for.)
javascript jquery scroll
No comments:
Post a Comment