I have this script to change main image on click to a link with .feature_thumb class. I want to make it so that it's both click and hover.
$(".feature_thumb").click(function(){
var main_href = $(this).attr('href');
change_image(main_href );
});
Can someone help me with this?
I tried this but it didn't work...
$(".feature_thumb").on('click hover') function(){
var main_href = $(this).attr('href');
change_image(main_href );
});
Thank you
hover()
jQuery method is a shorthand for$( selector ).mouseenter( handlerIn ).mouseleave( handlerOut );
In fact you wantmouseover
:Or depending exact expected behaviour and HTML markup, use
mouseenter
.