<script>
$(function () {
$('a[href*=#]:not([href=#])').click(function () {
$(".link").removeClass("active");
$(this).addClass("active");
if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 1000);
return false;
}
}
});
});
我有这个函数使垂直div可以滚动,我该如何实现它只在某些点触发的函数?