Search code examples
jquerylightboxloupe

jQuery loupe & prettyPhoto - how can I make them both working?


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!


Solution

  • You can just forward the trigger event onwards like this:

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

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