开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜