开发者

Start colorbox gallery window directly from click on img tag, without hyperlink tag

开发者 https://www.devze.com 2023-03-28 14:10 出处:网络
I have some image and I want colorbox to start its gallery directly from mouse click on img tag, not on a hyperlink tag开发者_如何学Python as the rules are. Is there any way to do that?$(\'img\').clic

I have some image and I want colorbox to start its gallery directly from mouse click on img tag, not on a hyperlink tag开发者_如何学Python as the rules are. Is there any way to do that?


$('img').click(function() {
    $(this).colorbox({href: $(this).attr('src')});
});

Also see my jsfiddle: http://jsfiddle.net/5HdQB/


first add a class to your imgs

<img src="..." class="myImg"/>

$('.myImg').click(function() {
    $(this).colorbox();
});
0

精彩评论

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