$(document).ready(function() {
$('.up img').on('click', function(){
$('.content').animate({top: '0'}, 1500, 'swing');
})
});
这并没有激发我的内容,让我感到很困惑......
答案 0 :(得分:2)
元素是否设置了top属性? 你可以使用scrollTop()
获得元素位置$('html, body').animate({scrollTop:$('#SOMETHING').offset().top - 20},1500, 'swing');
将SOMETHING id替换为您要滚动到的元素