문제

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