简体   繁体   English

jQuery插件冲突

[英]jQuery Plugin Conflict

does anyone know why theme animations can affect the waypoints plugin ( http://imakewebthings.com/waypoints/ ) from working properly and maybe how to solve this? 有谁知道主题动画为什么会影响正常工作的Waypoint插件( http://imakewebthings.com/waypoints/ ),以及可能如何解决?

I am using the plugin within my wordpress theme to toggle a class of my header when it has scrolled down a certain amount of another element to make some smooth shrinking effect. 我在我的wordpress主题中使用该插件来切换我的标头的类,当它向下滚动一定数量的另一个元素以产生平滑收缩效果时。 It works really easy and great. 它的工作原理非常简单而且很棒。

However, as soon as I add some animations, given by the theme to the page, the plugin stops working correctly. 但是,一旦我在页面上添加了主题提供的某些动画,插件就会停止正常工作。 Instead the class is added arbitrary or even not at all. 相反,该类是任意添加的,甚至根本没有添加。

I don't get any error messages in the debugger. 我在调试器中没有收到任何错误消息。

I am using following code snippet to toggle my header with the waypoint plugin: 我正在使用以下代码片段来切换航路点插件的标题:

var waypoints = jQuery('#hd-anm-anchor').waypoint({
handler: function(direction) {
jQuery('.fusion-header').toggleClass('header-active', direction === 'down');
},
offset: '-15%'
});

I can't comment yet so I'm going to try to answer your question. 我目前无法发表评论,因此我将尝试回答您的问题。 A solution to the problem could perhaps be if you use the older version of the plugin to toggle your header rather than the newer version. 解决问题的方法可能是,如果您使用旧版本的插件来切换标题,而不是使用新版本。 If you're using two versions of the same plugin both installed on the same instance of wordpress you're going to run into a ton of problems where there's conflicting commands 如果您使用同一插件的两个版本,并且两个版本都安装在同一wordpress实例上,那么在命令冲突的情况下,您将遇到大量问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM