开发者

jquery lightbox on dynamic image

开发者 https://www.devze.com 2023-01-06 23:36 出处:网络
I would like to use lightbox (pirobox) f开发者_StackOverflowor dynamically generated images. I use standard method - load css, js files and add selector on element, but it doesnt work. Have you any ex

I would like to use lightbox (pirobox) f开发者_StackOverflowor dynamically generated images. I use standard method - load css, js files and add selector on element, but it doesnt work. Have you any experiencies with it?

I Also try

$('.pirobox').bind('click', function() {
   $('.pirobox').piroBox({
      my_speed: 400, 
      bg_alpha: 0.3, 
      slideShow : true, 
      slideSpeed : 4, 
      close_all : '.piro_close,.piro_overlay'
   });
});


It is solved. Add this code after generating links.

$(document).find('a.lightbox').lightBox();


Use live instead, it can be used for elements present now or future (in your case).

$('.pirobox').live('click', function() {
   $('.pirobox').piroBox({
      my_speed: 400, 
      bg_alpha: 0.3, 
      slideShow : true, 
      slideSpeed : 4, 
      close_all : '.piro_close,.piro_overlay'
   });
});
0

精彩评论

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