Search code examples
jqueryprettyphoto

How I can get Current photo id in prettyphoto gallery


I am using prettyphotos to display slideshow and lightbox, but how I can get current photo id which is showing in Lightbox.

PrettyPhotos offer callback function changepicturecallback: function()

I tried it but am not able to get current photo id.

Am using this code

plz help

$("a[rel^='prettyPhoto']").prettyPhoto({theme: 'light_square',slideshow:5000,
            changepicturecallback: function(){
            //Run on every image change
                $('.gallery-list li').index($('.selected')).find('img').attr('id');

            }
        });

Solution

  • This should do the trick

    $pp_pic_holder.find("#pp_full_res img").attr("id");
    

    prettyphoto is somehow not fetching runtime elements.