I have a few images and their rollover images. Using jQuery, I want to show/hide the rollover image when the onmousemove/onmouseout event happen. All my image names follow t
img = { init: function() { $('img').on('mouseover', img.swap); $('img').on('mouseover', img.swap); }, swap: function() { var tmp = $(this).data('swap'); $(this).attr('data-swap', $(this).attr('src')); $(this).attr('str', tmp); } } img.init();