开发者

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

开发者 https://www.devze.com 2023-03-17 01:14 出处:网络
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

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 remo开发者_运维技巧ve the loupe initialization line: $('.demo').loupe(); prettyPhoto starts to work fine. Is there an easy way to make them both working properly?

Thank you!


You can just forward the trigger event onwards like this:

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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消