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();
});
精彩评论