Jquery 在滚动之间闪烁
我一直在尝试建立一个单页面的网站,现在Jquery并不是我的强项 我发现这段代码将滚动到div,我尝试过其他代码,但它们不会滚动 我的问题是,虽然大多数时候它会平滑地滚动,但有时当我点击菜单时,它会在滚动之前闪烁为白色,就像快速重新加载页面或其他什么 知道怎么回事吗Jquery 在滚动之间闪烁,jquery,Jquery,我一直在尝试建立一个单页面的网站,现在Jquery并不是我的强项 我发现这段代码将滚动到div,我尝试过其他代码,但它们不会滚动 我的问题是,虽然大多数时候它会平滑地滚动,但有时当我点击菜单时,它会在滚动之前闪烁为白色,就像快速重新加载页面或其他什么 知道怎么回事吗 $(document).ready(function(){ $(".contactLink").click(function(){ if ($("#contactForm").
$(document).ready(function(){
$(".contactLink").click(function(){
if ($("#contactForm").is(":hidden")){
$("#contactForm").slideDown("slow");
}
else{
$("#contactForm").slideUp("slow");
}
});
});
function closeForm(){
$("#messageSent").show("slow");
setTimeout('$("#messageSent").hide();$("#contactForm").slideUp("slow")', 2000);
}
$(document).ready(function() {
function filterPath(string) {
return string
.replace(/^\//,'')
.replace(/(index|default).[a-zA-Z]{3,4}$/,'')
.replace(/\/$/,'');
}
$('a[href*=#]').each(function() {
if ( filterPath(location.pathname) == filterPath(this.pathname)
&& location.hostname == this.hostname
&& this.hash.replace(/#/,'') ) {
var $targetId = $(this.hash), $targetAnchor = $('[name=' + this.hash.slice(1) +']');
var $target = $targetId.length ? $targetId : $targetAnchor.length ? $targetAnchor : false;
if ($target) {
var targetOffset = $target.offset().top;
$(this).click(function() {
$('html, body').animate({scrollTop: targetOffset}, 1000);
var d = document.createElement("div");
d.style.height = "101%";
d.style.overflow = "hidden";
document.body.appendChild(d);
window.scrollTo(0,scrollToM);
setTimeout(function() {
d.parentNode.removeChild(d);
}, 10);
return false;
});
}
}
});
});