action only if at top of page
-
Hi, I have this code that works great, but I only want it to happen if the page is scrolled all the way at the top. Is there something I can add to it to make it only work if the the page is scrolled all the way up?
var top1 = jQuery(window).scrollTop() ; if(top1 > 200) { jQuery('html, body').animate({ scrollTop: 0 }, '1000'); } else{ jQuery('html,body').animate({ scrollTop: jQuery('.content_wrapper').offset().top }, 1000); }
It’s on this page (https://w-ard.com/portfolio/tnt2/), when you click on the plus sign at the bottom this code is used to scroll the page down automatically, but if you’re already scrolled down it causes issues.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘action only if at top of page’ is closed to new replies.