当我点击下一个按钮时,它应该转到下一页的顶部,但它只向上滚动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;
});
});
try this,
$(window).animate(.....);