Question

I'm using http://bxslider.com/ for my photo gallery.

I need to get the path or the url of the image that is currently selected to pass to another variable.

How can I get the path or URL of the image that is currently selected?. That is, how I can get the image that the user is viewing?

Thank you very much!! :D

Was it helpful?

Solution

I haven't tried this but it should work in onBeforeSlide() or onAfterSlide() depending on what you want to accomplish.

function(idx, total, obj){

    // You can do this
    var src = $(obj).attr('src'); // Not sure if object already wrapped in jQuery

    // Or this
    var src = $('#slider img').eq(idx).attr('src');

    // Rest of the code...

}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top