How can I implement smooth scroll to top in a ajax extension that does pagination. The extension has the code following
if (block && amshopby_scroll_to_products) {
$$('body')[0].scrollTo();
}
and I have following code in my theme phtml which does smooth scroll to top functionality. Is it possible to call this functionality from the extension js file mentioned above.If not what is the the solution to implement?
var windowScroll_t;
$(window).scroll(function(){
clearTimeout(windowScroll_t);
windowScroll_t = setTimeout(function() {
if ($(this).scrollTop() > 100)
{
$('#scroll-to-top').fadeIn();
}
else
{
$('#scroll-to-top').fadeOut();
}
}, 500);
});
$('#scroll-to-top').click(function(){
$("html, body").animate({scrollTop: 0}, 600, "easeOutCubic");
return false;
});