-1
我有以下鏈接:http://www.alessandrosantese.com/test/aldemair-productions/project.htmljQuery的滾動到錨無法正常工作
,我使用這個滾動到一個id一個特定的div:
$('.project-nav a').on('click', function(e){
e.preventDefault();
var anchor = $(this).attr('data-id'),
el = $('#' + anchor);
$('html, body').animate({ scrollTop: el.offset().top}, 500);
});
它的工作原理差不多吧,它不在正確的位置滾動,他們似乎都是不正確的。
如果您點擊詳細信息,您將在上方滾動例如。