How can I combine toggle hover with on event? The code:
img.on('hover', function(){
name = $(this).attr('title');
function(){
$(this).parent().append('<figcaption>' + name);
},
function(){
$(this).find('figcaption').remove();
}
});
You have to split it into
mouseenterandmouseleave:which is what
hoverwraps into a single function.