2

I would like to apply two actions to a photo: 1. on hover: run jQuery loupe to magnify it 2. on click: run prettyPhoto to zoom it

PROBLEM: This is what I've been trying to do: http://jsfiddle.net/sherlock85/Udfey/ As you can see, the loupe works fine, but the prettyPhoto plugin does not. If I comment or remove the loupe initialization line: $('.demo').loupe(); prettyPhoto starts to work fine. Is there an easy way to make them both working properly?

Thank you!

s_sherly
  • 2,307
  • 4
  • 19
  • 14
  • this is the fiddle: http://jsfiddle.net/sherlock85/Udfey/1/ – s_sherly Jul 02 '11 at 09:06
  • It's just a guess, but I'd speculate the click event isn't making it to the image anymore and hence never triggering prettyPhoto. You might need to modify the loupe code to listen for click events on the div(or whatever it's using) it's placing over the picture and triggering the click event for the image from that handler. – kinakuta Jul 02 '11 at 09:12

1 Answers1

1

You can just forward the trigger event onwards like this:

$('.loupe').click(function(){   
      $(this).prev().trigger('click');     
});

example: http://jsfiddle.net/niklasvh/nKean/

Niklas
  • 29,752
  • 5
  • 50
  • 71