jquery - Fancybox trigger click not working online (after Ajax request) -


my jquery fancybox works on local computer, doesn't work on live website.

locally, gallery starts single click when takes 2 clicks online.

thanks help!

here code:

$(document).on('mousedown', '.photo', function(e){          if (e.which == 1) {              var clicked = $(this);              $.ajax({                 url: 'gallery.php?title="' + encodeuricomponent($(this).attr("data-name")) + '"',                 datatype: 'json'             }).done(function(data){                  if(data != ''){                     $('<div class="new-gallery hidden"></div>').insertafter(clicked);                     (var = 0; <= data.length ; i++) {                         (function(i) {                             $('<a class="fancybox" href="'+ data[i].dir +'" rel="gallery" title="'+ data[i].title +'"><img src="'+ data[i].dir +'" alt=""/></a>')                             .appendto('.new-gallery');                         })(i);                     }                 }              });              $(".fancybox")                 .fancybox({                     helpers   : {                          overlay : {closeclick: false},                     }                 });         }      });      $(document).on('click', '.photo', function(e){         e.preventdefault();         $(".fancybox").eq(0).trigger("click");     }); 


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -