Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get Image Data #326

Open
lucasjmiles opened this issue Oct 21, 2021 · 1 comment
Open

Get Image Data #326

lucasjmiles opened this issue Oct 21, 2021 · 1 comment

Comments

@lucasjmiles
Copy link

Not sure but how would I retrieve the current image data of the slide? Ie: the image url...

Im confused, this should be a base function or atleast some documentation concerning this.

   ```

var slider = $('#slider-car-details').data( 'sliderPro' );

    $( '#slider-car-details' ).on( 'gotoSlide', function( event ) {
        console.log( event.index );
        var $target = event.target;    
        var data = slider.getSlideAt(event.index)        
        console.log(data);
        var image = data.mainImage;
        console.log(image);

    })
@davidghi
Copy link
Member

If you want to use getSlideAt , this will return the image source: console.log(data.$mainImage[0].src), as you can see if you inspect the object returned by the method, but this method is mainly for retrieving other type of data, like the settings. To get attribute values, you could use this instead: console.log($mySlider.find('.sp-selected .sp-image').attr('src'));

Best,
David

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants