我有这个WordPress主题,但我无法使jQuery脚本正常工作,我尝试了所有内容,没有冲突模式,包括在footer.php中包括我自己的jQuery,并在queue.php中包括了自己的jQuery,在header.php中包括了jQuery'。 jQuery等
当我不在WordPress主题中时,我所有的脚本都能正常工作。
我的网址是http://andreas-berg.dk/wordpress/,我的脚本位于脚本的最底部,现在我将jQuery硬编码到footer.php中,并从顶部将其删除,但没有成功。
有解决这个问题的想法吗?我已经把头发拉了好几个小时了。
这些是我的脚本:
!function( $ ) {
$(".dropbutton a").click(function () {
$("#dropdown").slideToggle();
});
$('.scroll-button').hide().fadeIn(1000);
$(".slide").mouseenter(function () {
$(this).children().stop().slideDown(200);
}).mouseleave(function () {
$(this).children().stop().slideUp(200);
});
$('.nav-container a, .scroll-button a, .blocks a, .banner a, .text-right a').click(function () {
$('html, body').animate({
scrollTop: $($(this).attr('href')).offset().top - 60
}, 800, 'easeOutQuint');
return false;
});
offsetValue = 60;
$('body').data().scrollspy.options.offset = offsetValue;
// force scrollspy to recalculate the offsets to your targets
$('body').data().scrollspy.process();
$('body').scrollspy({
target: '.nav-container'
});
}( window.jQuery );
您的JQuery运行正常。如果您检查您的conole,您会看到一些错误,例如
**1068** errors stating: Uncaught TypeError: Object #<Object> has no method 'easeOutQuint'
为此,您需要安装jQuery Easing Plugin
检查您的错误,您的JS不能仅仅因为您的代码中存在严重错误而无法运行。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句