我该如何正确检查当前页面的URL,以及该URL是否在数组中为页面设置动画效果?以下是我到目前为止,但每个页面动画不只是在我的数组中。基于url的动画页面
此脚本加载在页脚的每个页面上。
我相信这很简单,但我有限的JS知识。谢谢!
var pageArray = new Array("/how-it-works.php", "/themethodology.php", "/thecommunity.php","/thetools.php");
var currrentPage = window.location.pathname;
if (jQuery.inArray(jQuery('currrentPage'), pageArray)){
$('html, body').animate({
scrollTop: $("#pageheader_cont").offset().top
}, 1000);
}
你是什么意思*“每页动画”* ..?一个网址打开一页,右.. ..? 0.o – 2014-09-26 07:11:03
对不起,我不是更清楚。点击加载我的导航中的每一页。但页面,但它不应该动画,除非该页面在数组中。 – Denoteone 2014-09-26 07:41:34
请更新问题并在其中添加额外信息,而不是在评论中。那么,你在所有页面上都有相同的脚本? – 2014-09-26 08:08:02