【发布时间】:2013-05-14 06:19:54
【问题描述】:
我正在使用 jQuery 进行页面转换,方法是在页面加载时淡出内容并将其淡入,但我的问题是当我单击链接并调用我的点击函数并重定向它在顶部加载的页面时页。有没有办法可以防止这种行为?这是我的页面转换的点击功能,提前感谢您的帮助!
链接
<a href="../categories/categories.php"></a>
jQuery
$(".content").fadeIn(750);
$("a").click(function(event){
event.preventDefault();
linkLocation = this.href;
$(".content").fadeOut(500, redirectPage);
});
function redirectPage() {
window.location = linkLocation;
}
【问题讨论】:
-
你能提供标记吗,如果你创建一个新的小提琴来看看它是如何工作的。
-
听起来您需要设置标记样式。
javascript工作正常。
标签: javascript jquery redirect scroll preventdefault