views:

35

answers:

2

I would like to use lightbox (pirobox) for 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'
   });
});
A: 

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'
   });
});
Sarfraz
It doesnt work. After click on element .pirobox is activated the function, but pirobox doesnt work. It open image as URL in browser. I try also other lightbox (http://leandrovieira.com/projects/jquery/lightbox/), but it is same result. It work on server's generated elements, but it doesnt work on jquery's generated elements.
m.brezovsky
A: 

It is solved. Add this code after generating links.

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