jquery - Fancybox popup prevent when checkbox is clicked -


i have problem checkbox in image.while clicking on image fancybox opened fine.if click on checkbox again fancybox opened.it should not opened when checkbox click.

html code

<div class="picture">  <a  href="http://farm1.staticflickr.com/313/19831416459_5ddd26103e_m.jpg" class="fancybox popup_fancy"  rel="gallery1" id="fancybox_popup">  <img src="http://farm1.staticflickr.com/313/19831416459_5ddd26103e_m.jpg" alt="">  <div class="img-overlay"> <input type="checkbox"  class="img_checkobx" name="imgcheckbox"  onclick="checkbox(this);"/>  </div></a> </div> 

image appear this

enter image description here

and fancybox js this

$(document).ready(function() {     $(".fancybox").fancybox({         openeffect  : 'none',         closeeffect : 'none'     });  }); 

prevent fancybox popup when checkbox click event. suggest how solve problem.thanks in advance

just stop propagation of event siblings using e.stopimmediatepropagation() on checkbox click below:

$('.img_checkobx').click(function(e){     e.stopimmediatepropagation(); }); 

demo here


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -