【发布时间】:2015-08-05 09:40:12
【问题描述】:
因为我想在用户单击链接时显示一个简短的动画,所以我想在重定向之前确保动画是完整的。为此,我想我可以设置一个简单的时间来跟踪链接,如下所示:
$("a[href^='http://'], a[href^='https://']").click(function(e) {
setTimeout(function() {
window.location.href = $(this).attr("href");
}, 1200);
console.log($(this).attr("href"));
e.preventDefault();
});
显然,它没有。虽然我不明白为什么。没有调用 console.log,但我很确定我的选择器是正确的。我在这里错过了什么?
【问题讨论】:
-
看起来是 jQuery edge 的问题 - jsfiddle.net/arunpjohny/wcc989jk/1 - edge 抛出类似
Uncaught TypeError: url.indexOf is not a function的错误