0

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;
    });

2 Answers 2

1

You probably use Amasty module, I had the same problem. There is hidden option in amshopby-ajax.js just change false to true. and ajax filtering will scroll to top

var amshopby_toolbar_selector = 'div.toolbar';
var amshopby_scroll_to_products = false;
0

Though this question is not related to magento at all but, I love to answer this question,

use this Jquery plugin , and integrate in product view page. see its demo and how to implement section you will easily integrate this beautiful plugin.

https://markgoodyear.com/2013/01/scrollup-jquery-plugin/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.