简体   繁体   中英

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?

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. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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