質問

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

役に立ちましたか?

解決

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...

}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top