Hey all I was just wondering how I would create an effect on jquery and/or javascript where when the user scrolled upwards, a div would appear.
Thanks!
Hey all I was just wondering how I would create an effect on jquery and/or javascript where when the user scrolled upwards, a div would appear.
Thanks!
If you find a way to detect the scroll up
event, then the whole process is too easy.
To detect scroll up I have used to below approach,
$(function () { //Keep track of last scroll var lastScroll = 0; $(window).scroll(function (event) { //Sets the current scroll position var st = $(this).scrollTop(); //Determines up-or-down scrolling if (st > lastScroll) { //Replace this with your function call for downward-scrolling $('#up').hide(); } else { //Replace this with your function call for upward-scrolling $('#up').show(); } //Updates scroll position lastScroll = st; }); });
Keep a fixed positioned div
and hide/show
based on the scroll is what I have done.