Share Posted February 23, 2016 What started out as a simple replacement of a jQuery .hover() function with native javascript has turned into to a roadblock for me. I am replacing a simple hover tween with the native onmouseenter/onmouseleave in a javascript function I have created. The function is approximately 1000 lines of code so it took some time to break out the components into codepen to demonstrate my problem: If you review the codepen, I have a function in the global namespace that takes options from the user to set certain callbacks or hooks. Using the original jQuery .hover() function produces the results I want. The replacement in native javascript does not. However, note that the last 2 buttons use the replacement javascript successfully except the tween is defined at the same scope and does not go through the user hook. If anyone can explain to me why the jQuery function works through the hook while the javascript function does not, I would appreciate it. Also note that the javascript object returned by the tween is different between the 2. See the Pen OMeKMo by hackfin (@hackfin) on CodePen Link to comment Share on other sites More sharing options...
Share Posted February 23, 2016 I could be wrong but don't you think that your second `[].forEach()` call should have `.js-button` as its target elements rather than the same `.jq-button`? Does that help? 2 Link to comment Share on other sites More sharing options...
Author Share Posted February 23, 2016 Tahir, thanks. Unfortunately that means I have not entered enough of my code into codepen to reduplicate the issue. I will adjust my codepen and post back when it is ready (broken). Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now