jQuery(document).ready(function(){
 jQuery(".um-img-resize").hover(
      function(){this.src = this.src.replace("_off","_on");},
      function(){this.src = this.src.replace("_on","_off");
      });
});

I’m relatively new to jQuery scripting, and I’m running into a problem trying to do an image swap on hover using a Mega Menu plugin for wordpress. Basically, I want a hover image to transition slowly rather than the simple “on” “off”

This code works for the image swap no problem, but I’m having a hard time adding the transition to this. Adding .fadeIn(500) or .animate just makes errors.

I’ve seen a CSS solution, but that requires two image src’s and I don’t want to modify the code for the plugin itself, to keep it forward compatible.

Thanks.

Read more here: Image swap with jQuery Hover using a single image source and transition


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , , , ,

Wordpress related questions and answers: