jquery进入顶部

jquery进入顶部,jquery,Jquery,当我点击“下一步”按钮时,它会转到下一页的顶部,但只会向上滚动3/4页……有人有什么建议吗 jQuery(document).ready( function($) { $("a#checkout-next").click( function() { $("#shopping-cart-form").fadeIn(); var checkoutWidth = $("#shopping-cart").width() + 30;

当我点击“下一步”按钮时,它会转到下一页的顶部,但只会向上滚动3/4页……有人有什么建议吗

jQuery(document).ready( function($) {
        $("a#checkout-next").click( function() {
            $("#shopping-cart-form").fadeIn();
            var checkoutWidth = $("#shopping-cart").width() + 30;
            $("#checkout-bar-in").animate( {
                width :'+=50%'
            });
            $("#checkout-slider").animate( {
                marginLeft :'-=' + checkoutWidth
            }, 800, function() {
                $('body,html').animate( {
                    scrollTop :0
                }, 800);
            });
            return false;
        });
        $("a#checkout-back").click( function() {
            $("#shopping-cart-form").fadeOut();
            var checkoutWidth = $("#shopping-cart").width() + 30;
            $("#checkout-bar-in").animate( {
                width :'-=50%'
            });
            $("#checkout-slider").animate( {
                marginLeft :'+=' + checkoutWidth
            }, 800, function() {
                $('body,html').animate( {
                    scrollTop :0
                }, 800);
            });
            return false;
        });
    });
试试这个

$(window).animate(.....);
代替
$('body,html')。动画({scrollTop:0},800)
你认为我还是应该使用
{scrollTop:0},800