Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

How to autoscroll to shipping methods section in one page checkout after clicking continue? 
 
lastev
Jr. Member
 
Total Posts:  6
Joined:  2013-09-04
 

Hi, this question deals with the one page checkout page.

I want the browser to autoscroll down to the shipping methods section after clicking the continue button on the billing address section(with ‘SHIP TO THIS ADDRESS’ checked). The autoscroll should happen right after the shipping methods section gets populated.

The below code works, but not in the correct order - the scrolling occurs first, then the ajax request for the billing address gets processed, and finally the shipping method section is expanded/populated. I do not want that - I want the ajax request to complete and the shipping method section to be populated before scrolling down.

Is there someway to delay the scroll until the ajax request is finished and the shipping method section is expanded?

var jQuery.noConflict(); 
          
j(document).ready(function(){
            
//Click event handler for continue button on billing address section
            
j("#billingContinueButton").click(function (){
                 
//check to see if 'SHIP TO THIS ADDRESS' radio button is checked
                
if(document.getElementById("shipToThisAddressRadio").checked{
                        
//animate scroll to shipping method section
                        
j("html, body").animate({
                                scrollTop
j("#idOfShippingMethodSection").offset().top
                            }
2000);
                
}
            }
);
        
});
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top