Is there a way to link directly to a specific image in a slider? I have thumbnail images that I would like to open up in the corresponding larger slider image when clicked. Is there a way to do this? I'm using the Canvas slider.
Linking To A Specific Image In a Slider
3 replies · opened Jul 1, 2021
Hello,
This is Definitely Possible. You can consider using the following JS Code:
const swiper = document.querySelector('.swiper-container').swiper;
swiper.slideTo( 1, 300 );You can simply use the swiper.slideTo( index, speed ); Code when clicking on the Thumbnail using JS.
This will definitely work fine. Hope this Helps!
Let us know if we can help you with anything else or if you find any further issues.
Thanks for your reply. Apologies, but I'm not familiar with JS so would you be able to tell me exactly where and how this code needs to be placed?
Unfortunately, this feature is currently not available within the Default Templates. We will surely consider adding this in Our Future Updates and will send you a Notification once this is available.
The JS Codes provided above are as-is and any further customization or feature/functionality enhancements is your responsibility as we currently do not provide Customization related Support according to the Item Support Policy: https://themeforest.net/page/item_support_policy .
For the JS Codes you will need to add them at the bottom of the Page after the js/functions.js JS File Linking:
<script>
const swiper = document.querySelector('.swiper-container').swiper;
$('.thumbnail').on( 'click', function(){
let target = $(this).attr( 'data-target' );
swiper.slideTo( Number( target ), 300 );
});
</script>In the HTML Codes, you will simply need to add add the .thumbnail Class to the Thumbnail Image and then add data-target="{index}" Attribute to it. Replace {index} with the Slider Image index.
Hope this Helps!
Let us know if we can help you with anything else or if you find any further issues.
Have the same question, or something new?
Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.
Reply on the dashboard