0
我有這個腳本,打開一個新頁面,向下滾動到一個ID獲得一些內部鏈接的動畫工作
var jump = function (e) {
if (e) {
e.preventDefault();
var target = $(this).attr("href");
} else {
var target = location.hash;
}
$('html,body').animate(
{
scrollTop: $(target).offset().top
}, 2000, function() {
location.hash = target;
});
}
$('html, body').hide();
$(document).ready(function() {
$('a[href^=#]').bind("click", jump);
if (location.hash) {
setTimeout(function() {
$('html, body').scrollTop(0).show();
jump();
}, 0);
} else {
$('html, body').show();
}
});
我想要做什麼是,使動畫與內部鏈接當前頁面上的滾動。我如何整合?
你最終解決您的問題? –