Elementor Image Carousel Links - Add a Different Link to Each Image

No extra plug-ins required! Elementor Free compatible!

Here is how to easily add a different link to every image in the basic image carousel element from Elementor Free. These Elementor image carousel links are not yet available directly from that element’s settings.

Working example:

To begin with, add an HTML element on the same page as the Elementor Image Carousel

It doesn’t really matter where on the page the Element is added…

Elementor Image Carousel Links - Custom Link for Each Image 1

After that, add a class name to your Elementor carousel element

Give it the class name “carousel1” under Advanced > CSS Classes.

Elementor Image Carousel Links - Custom Link for Each Image 2

Set your carousel to "loop"

The code provided will only work if your carousel is set to loop.

Elementor Image Carousel Links - Custom Link for Each Image 3

Then, add this code the html element, and edit the links to your own

Important: the first link will be automatically linked with the first image in the gallery, and so on.

<script> 
/* Please login to get the code 
 * The code will be for the Elementor Image Carousel Links - Custom Link for Each Image tutorial 
 * Found at this URL https://element.how/elementor-image-carousel-links/ 
 */ 
</script>

To make it work with multiple Image Carousel elements on the same page, use the code below instead.

You will also need to add the class ‘carousel1’ , ‘carousel2’ , ‘carousel3’ etc to each Image Carousel (Under Advanced > CSS Classes).

<script> 
/* Please login to get the code 
 * The code will be for the Elementor Image Carousel Links - Custom Link for Each Image tutorial 
 * Found at this URL https://element.how/elementor-image-carousel-links/ 
 */ 
</script>

Finally, enjoy your Elementor carousel links!

Important: the ‘link’ setting in the Elementor Image Carousel needs to be set to ‘none’!

Important: It might not work while you are logged into WordPress. To verify that it is working, visit your page in incognito mode.

Same window instead of  new tab: replace this line of code

window.open(links[i]);

with this code

location = links[i];

to open the links in the same window. instead of opening in a new tab 

Extra: Want these Elementor Gallery Images to open a Popup ? Use this code instead.

Check this image to find your popup IDs.

<script> 
/* Please login to get the code 
 * The code will be for the Elementor Image Carousel Links - Custom Link for Each Image tutorial 
 * Found at this URL https://element.how/elementor-image-carousel-links/ 
 */ 
</script>

Et voila! Thanks for reading!
Let me know if you need help!

180 Responses

  1. Hey Maxime!

    I know this is not exactly the question for this thread, but still, hopefully you can help me!
    Is there a way I can use custom added icons to move the image carousel?
    I have added 2 arrows, outside of elementor image carousel with custom placing and I need them to move the slides left and right.

    I need to use querySelector to select the image carousel class (which is image-car ) and initiate the swiper slider? After that Im pretty much stuck.
    The left arrow has a id of arrow-prev and right one has id of arrow-next.

    Thanks in advance!

  2. Hi this does not seem to work for me
    https://www.onlinebeautyproducts.com.au/product-category/tanning/
    I have link set to 'none' on my carousel

    .swiper-slide-image{cursor: pointer;}

    document.addEventListener('DOMContentLoaded', function () {

    /* Edit the links HERE */
    let links = [
    'https://www.onlinebeautyproducts.com.au/brands/sunescape/',
    'https://www.onlinebeautyproducts.com.au/brands/moroccan-tan/',
    'https://www.onlinebeautyproducts.com.au/brands/ecococo/',
    'https://www.onlinebeautyproducts.com.au/brands/summer-tan/'
    ];

    document.body.addEventListener('click', function (e) {
    if (e.target.closest('.carousel1 .swiper-slide')){
    let i = e.target.closest('.swiper-slide').getAttribute("data-swiper-slide-index");
    if (links[i].length > 2){
    window.open(links[i]); /* TO OPEN LINKS IN SAME WINDOW USE: location = links[i]; */
    }
    }
    });
    });

  3. hello
    i am using this code but links go : about:blank. Not sure why. Can u please help?

    .swiper-slide-image{cursor: pointer;}

    document.addEventListener('DOMContentLoaded', function () {

    var filteredImages = document.querySelectorAll('.carousel1.swiper-slide');

    //Edit the links HERE
    var links = [
    "https://diggitymarketing.com/",
    'https://create.element.how/elementor-pop-ups-problems/',
    'https://create.element.how/amazing-accordion-section/',
    'https://create.element.how/awesome-hexagonal-boxes/',
    'https://create.element.how/show-header-hamburger-click/',
    'https://create.element.how/elementor-centered-logo-header/'
    ];

    document.body.addEventListener('click', function (e) {
    if (e.target.closest('.swiper-slide')){
    let i = e.target.closest('.swiper-slide').getAttribute("data-swiper-slide-index");
    window.open(links[i]);
    }
    });
    });

  4. This no longer works with the new Elementor and Elementor Pro updates. It was working fine in May 2023; however, June's update stopped the functionality of multiple URLs in the image carousel.

    document.addEventListener('DOMContentLoaded', function () {
    /* Edit the links HERE */
    let links = [
    'https://link1.com',
    'https://link2.com',
    'https://link3.com'
    ];

    const carousel = document.querySelector('.carousel1');

    if (!carousel) {
    console.warn('No Elementor carousel found with class "carousel1".');
    return;
    }

    const slides = carousel.querySelectorAll('.swiper-slide');

    slides.forEach((slide, index) => {
    slide.style.cursor = 'pointer';
    slide.addEventListener('click', () => {
    if (links[index] && links[index].length > 2){
    window.open(links[index]); /* TO OPEN LINKS IN SAME WINDOW USE: location = links[index]; */
    }
    });
    });
    });

    1. Hi J,

      This last code doesn't work for me. I see the text appear in the HTML section on the site. Am I doing something wrong?

      Greetings, Rean

      1. Greetings Rean!

        If your carousel is set to loop, use the code provided in the tutorial.

        Cheers!

    2. Greetings J!

      The code provided in the tutorial is tested working as of the latest Elementor version. This website runs the latest version, and I have a working demo on this page.

      The code you provided is great and what I used to give here a long time ago. However there is one serious flaw with it: it doesn't consider that in a Swiper slider, the DOM constantly changes and slides get added and removed, when in loop mode.

      So you add an event listener to the slides that are currently in the DOM when the code runs. However it will change, and if the user ends up clicking in a slide freshly added to the DOM, then the click event won't be on it.

      If your carousel isn't looping it's not a problem, however I think most people set it to loop.

      The way I coded this in the tutorial prevents any issue regarding these DOM changes.

      Cheers!

    3. Upon further testing I see that my code does not work if the carousel is NOT set to loop, so in these cases your code is a great alternative!

      Cheers!

  5. Hi, dude I have been reading all your reply and it's impressive that u are still replying after 3 years x)
    Im making an home page with an images carousel but the code doesnt work... thats sad.
    I did everything like u said and it's still not working... I'm not giving up so could u please tell me why it is not working ???
    .swiper-slide-image{cursor: pointer;}

    document.addEventListener('DOMContentLoaded', function () {

    var filteredImages = document.querySelectorAll('.swiper-slide');

    //Edit the links HERE
    var links = [
    'https://www.e-movens.fr/gestion-carte-carburant-flotte-automobile/40-dkv.html',
    'https://www.e-movens.fr/vehicules/62-renault.html',
    'https://www.e-movens.fr/securite-incendie/279-alternatives-preventions.html',
    'https://www.e-movens.fr/locaux-pro-reglementation/550-rema-groupe.html',
    ];

    document.body.addEventListener('click', function (e) {
    if (e.target.closest('.swiper-slide')){
    let i = e.target.closest('.swiper-slide').getAttribute("data-swiper-slide-index");
    location = links[i];
    }
    });
    });

    Thanks

      1. oh, it's not about the second carousel, but the first images u see when u land on the website. It's the 4 images carousel that I need to work

    1. Here is the link: puntagordachamber.com

      We only want the links attached to the Gold slider.

      Also, here is the code:
      .swiper-slide-image{cursor: pointer;}

      document.addEventListener('DOMContentLoaded', function () {

      /* Edit the links HERE */
      let links = [
      'https://www.beaneatkinson.com',
      'https://thecaptainstable.com',
      'https://laishleycrabhouse.com',
      'https://bigshotmad.com',
      'https://harpoonharry.com',
      'https://www.dwsussman.com',
      'https://www.iheartmedia.com',
      'https://www.kw.com/agent/UPA-6587385214940647426-5',
      'https://landsbergbennett.com',
      'https://www.poolboyinc.com',
      'https://www.puntagordachamber.com/punta-gorda-farmers-market/',
      'https://www.shorepointhealthcharlotte.com',
      'https://southportseniorliving.com',
      'https://suncoastbeverage.com,
      'https://tamiamitavern.com',
      'https://nixandassociates.com',
      'https://swflparrot.com',
      'https://time-realty.com',
      'https://wm.com',
      'https://thewyvernhotel.com'
      ];

      document.body.addEventListener('click', function (e) {
      if (e.target.closest('.carousel1 .swiper-slide')){
      let i = e.target.closest('.swiper-slide').getAttribute("data-swiper-slide-index");
      if (links[i] && links[i].length > 2){
      window.open(links[i]); /* TO OPEN LINKS IN SAME WINDOW USE: location = links[i]; */
      }
      }
      });
      });

      1. Greetings Kaity!

        You have a typo here:

        'https://suncoastbeverage.com,

        Should be:

        'https://suncoastbeverage.com',

        Cheers!

  6. Hi, thank you!

    I made that update, but it's still not working. When I hover over the images, the mouse changes to the "click" option, but when I click, nothing happens.

    1. Almost there Kaity!

      Now you have the "carousel1" in your CSS ID field, but it should be in the CSS Classes field, right below!

  7. I had it working for one of my carousels!

    But when I added the multiple carousel code, none of them are working now. Both CSS classes are carousel1 and carousel2

    Her is the code: (sorry for the length)
    <style>.swiper-slide-image{cursor: pointer;} </style>

    <script>
    /* For Carousel 1 on the page */

    document.addEventListener('DOMContentLoaded', function () {

    /* Edit the links HERE */
    let links = [
    'https://www.beaneatkinson.com&#039;,
    'https://thecaptainstable.com&#039;,
    'https://laishleycrabhouse.com&#039;,
    'https://bigshotmad.com&#039;,
    'https://harpoonharry.com&#039;,
    'https://www.dwsussman.com&#039;,
    'https://www.iheartmedia.com&#039;,
    'https://www.kw.com/agent/UPA-6587385214940647426-5&#039;,
    'https://landsbergbennett.com&#039;,
    'https://www.poolboyinc.com&#039;,
    'https://www.puntagordachamber.com/punta-gorda-farmers-market/&#039;,
    'https://www.shorepointhealthcharlotte.com&#039;,
    'https://southportseniorliving.com&#039;,
    'https://suncoastbeverage.com&#039;,
    'https://tamiamitavern.com&#039;,
    'https://nixandassociates.com&#039;,
    'https://swflparrot.com&#039;,
    'https://time-realty.com&#039;,
    'https://wm.com&#039;,
    'https://thewyvernhotel.com&#039;
    ];

    document.body.addEventListener('click', function (e) {
    if (e.target.closest('.carousel1 .swiper-slide')){
    let i = e.target.closest('.swiper-slide').getAttribute("data-swiper-slide-index");
    if (links[i] && links[i].length > 2){
    window.open(links[i]); /* TO OPEN LINKS IN SAME WINDOW USE: location = links[i]; */
    }
    }
    });
    });

    /* For Carousel 2 on the page */

    document.addEventListener('DOMContentLoaded', function () {

    /* Edit the links HERE */
    let links = [
    'https://www.crews.bank&#039;,
    'https://jmerakibeauty.com&#039;,
    'https://militaryheritagemuseum.org,
    'https://www.americanleakdetection.com&#039;,
    'https://www.camrealty.us&#039;,
    'https://www.swflvisitor.com/index.php,
    'https://www.mycreativewindow.com&#039;,
    'https://mydestinationflorida.com&#039;,
    'https://www.dreamsalonspa.net&#039;,
    'https://everythingpuntagorda.com/the-city-of-punta-gorda-information-website/&#039;,
    'https://www.fishermensvillage.com&#039;,
    'https://www.friendlyfloors.com&#039;,
    'https://www.islesyc.com&#039;,
    'https://www.johnsontaylorfuneral.com&#039;,
    'https://karamiles.kw.com&#039;,
    'https://www.mccrorylaw.com&#039;,
    'https://www.michaelsaunders.com&#039;,
    'https://pgchocolateandwine.com&#039;,
    'https://wm.com&#039;,
    'https://thewyvernhotel.com&#039;,
    'https://www.andrewsfss.com&#039;,
    'https://www.wengradio.com&#039;,
    'https://www.whitcoinsurancepg.com&#039;,
    'https://pgchocolateandwine.com&#039;,
    'https://charlottecf.org/?subcat=7&#039;,
    'https://www.levellwealthmanagement.com&#039;,
    'https://www.levellwealthmanagement.com&#039;,
    'https://www.meridiansenior.com/senior-living/fl/punta-gorda/meridian-at-punta-gorda-isles/&#039;,
    'https://walkerrealtygroupllc.com&#039;,
    'https://www.sunseekerresorts.com&#039;,
    'https://www.instagram.com/connectprintpromotions&#039;
    ];

    document.body.addEventListener('click', function (e) {
    if (e.target.closest('.carousel2 .swiper-slide')){
    let i = e.target.closest('.swiper-slide').getAttribute("data-swiper-slide-index");
    if (links[i] && links[i].length > 2){
    window.open(links[i]); /* TO OPEN LINKS IN SAME WINDOW USE: location = links[i]; */
    }
    }
    });
    });

    </script>

      1. Okay, I found a miss apostrophe on the swflvisitor.com line, and fixed that, but it is still not working

  8. I've tried setting this up on the front page of a site, and for the life of me can't figure out why it's not working. https://www.fauxstainedglasspanes.com

    I've tried numerous things to no avail (among other things, I have tried it with a specific class associated with the image carousel although at the moment the target in the html is just '.swiper-slide'). I think I've got it reset back to the recommended implementation, but it just ain't working. The closest I've come is when reloading the page, I see the pointer hovering over the carousel for a moment, but then it resets as the page continues to load and no longer works. I've tried to walk through the loading code in the dev tools with breakpoints to suss out the offender, but it's a bit out of my depth and I wasn't able to find anything conclusive. If I can get a pointer, I'd appreciate it.

  9. My issue with the carousel links not working was because I was using the 'fade' transition. I managed to come up with a solution that works in that case...

    <style>
    .elementor-image-carousel.swiper-wrapper {
    cursor: pointer;
    }
    </style>

    <script>
    document.addEventListener('DOMContentLoaded', function () {

    /* Put all your links HERE */
    let links = [
    'https://www.yoursite.com/product/yourproduct-01&#039;,
    'https://www.yoursite.com/product/yourproduct-02&#039;,
    ];

    /* Add your carousel class as the argument of the querySelector function HERE */
    const carousel = document.querySelector('.carousel1');
    carousel.addEventListener('click', function () {
    const activeSlide = carousel.querySelector('.swiper-slide-active');
    const index = activeSlide.getAttribute("data-swiper-slide-index");
    window.location.href = links[index];
    });
    });

  10. I added the code as recommended, but the links aren't working? https://andrewsartistry.com/value-crafted/

    Here's the code:

    <style>.swiper-slide-image{cursor: pointer;} </style>

    <script>
    /* For Carousel 1 on the page */

    document.addEventListener('DOMContentLoaded', function () {

    /* Edit the links HERE */
    let links = [
    'https://andrewsartistry.thrivecart.com/allure-branding-package/&#039;,
    'https://andrewsartistry.thrivecart.com/ballet-etoile-branding-package/&#039;,
    'https://andrewsartistry.thrivecart.com/echosphere-branding-package/&#039;,
    'https://andrewsartistry.thrivecart.com/essence-branding-package/&#039;,
    'https://andrewsartistry.thrivecart.com/namaste-branding-package/&#039;,
    'https://andrewsartistry.thrivecart.com/powerhouse-branding-package/&#039;
    'https://andrewsartistry.thrivecart.com/premier-branding-package/&#039;
    'https://andrewsartistry.thrivecart.com/pulsebeat-branding-package/&#039;
    'https://andrewsartistry.com/sunnyskip-branding-package/&#039;
    'https://andrewsartistry.thrivecart.com/urban-funk-branding-package/&#039;
    ];

    document.body.addEventListener('click', function (e) {
    if (e.target.closest('.carousel1 .swiper-slide')){
    let i = e.target.closest('.swiper-slide').getAttribute("data-swiper-slide-index");
    if (links[i] && links[i].length > 2){
    window.open(links[i]); /* TO OPEN LINKS IN SAME WINDOW USE: location = links[i]; */
    }
    }
    });
    });

    /* For Carousel 2 on the page */

    document.addEventListener('DOMContentLoaded', function () {

    /* Edit the links HERE */
    let links = [
    'https://andrewsartistry.thrivecart.com/show-materials-cirque-de-dance/&#039;,
    'https://andrewsartistry.thrivecart.com/dance-your-heart-out-show-materials/&#039;,
    'https://andrewsartistry.thrivecart.com/enchanted-forest-show-materials/&#039;,
    'https://andrewsartistry.thrivecart.com/everybody-dance-now-show-materials/&#039;,
    'https://andrewsartistry.thrivecart.com/never-miss-a-chance-show-materials/&#039;,
    'https://andrewsartistry.thrivecart.com/new-york-show-materials/&#039;
    ];

    document.body.addEventListener('click', function (e) {
    if (e.target.closest('.carousel2 .swiper-slide')){
    let i = e.target.closest('.swiper-slide').getAttribute("data-swiper-slide-index");
    if (links[i] && links[i].length > 2){
    window.open(links[i]); /* TO OPEN LINKS IN SAME WINDOW USE: location = links[i]; */
    }
    }
    });
    });

    /* For Carousel 3 on the page */

    document.addEventListener('DOMContentLoaded', function () {

    /* Edit the links HERE */
    let links = [
    'https://andrewsartistry.thrivecart.com/dance-your-heart-out-poster-art/&#039;,
    'https://andrewsartistry.thrivecart.com/dancer-photo-and-illustration-quote/&#039;,
    'https://andrewsartistry.thrivecart.com/custom-watercolor-portrait-art/&#039;,
    'https://andrewsartistry.thrivecart.com/dance-with-a-pegasus-poster-art/&#039;,
    'https://andrewsartistry.thrivecart.com/dance-with-a-chimera-poster-art/&#039;,
    'https://andrewsartistry.thrivecart.com/dance-with-an-elf-poster-art/&#039;
    'https://andrewsartistry.thrivecart.com/dance-with-a-phoenix-poster-art/&#039;
    'https://andrewsartistry.thrivecart.com/aerial-arts-with-a-pixie-poster-art/&#039;
    ];

    document.body.addEventListener('click', function (e) {
    if (e.target.closest('.carousel3 .swiper-slide')){
    let i = e.target.closest('.swiper-slide').getAttribute("data-swiper-slide-index");
    if (links[i] && links[i].length > 2){
    window.open(links[i]); /* TO OPEN LINKS IN SAME WINDOW USE: location = links[i]; */
    }
    }
    });
    });

    /* For More carousels, keep duplicating the code in the same fashion, replacing '.carouselx' with the right x value */
    </script>

Leave a Reply

Element.How Newsletter

Sign up for our newsletter to get Elementor related updates and tutorials