Search code examples
phpjqueryjquery-pluginsphp-5.3

jquery lightbox plugin group of images effect


http://www.leandrovieira.com/projects/jquery/lightbox/ sample


so i have get images in while loop here is my code

<td id="gallery">

<a href='<?=$path ?>'>
 <img width="50" height="50" src=<?php echo $path; ?> />
 </a>

</td>


 $(function() {
            $('#gallery a').lightBox();
        });
    </script>

when i click first image light box effect works fine but when i click second image light box effect does n't work please guide me

Thanks for Advance


Solution

  • The problem is you have multiple <td id="gallery". You shouldn't use the same id for multiple elements, because $('#gallery') would always return the first one, but also because it's wrong!

    Either move it into the table: <table id="gallery",

    or change it to class: <td class="gallery" and change the query: $('.gallery a').lightBox();