Reputation: 458
I'm using this jQuery plugin: http://gianlucaguarini.com/canvas-experiments/jQuery.BlackAndWhite/. It basically sets images in black and white, and when you hover the image, it gets colored.
Now I'm wondering if it would be possible to trigger the plugin (color the picture) when hovering something else (some text).
I tried triggering hover() and mouseenter on the element, but that didn't seem to do the trick.
Upvotes: 0
Views: 146
Reputation: 471
I just tried binding the image trigger event to different element and it worked.
I did that:
$('elem').on('click', function() {
$('.imgWrap').eq(0).trigger('mouseenter');
});
It worked, it colored the picture, so triggering mouseleave
will uncolor it again.
You have to find a way to determine which element triggers which image (the .eq(0)
is just for testing, in a real situation you will need something more specific, otherwise you will affect all images.
Upvotes: 1