Need help with the captions on this gallery slider

If you go to this page and scroll down to the gallery section, https://www.stadriemblems.com/products/enamel-pins-test/ I want the links in the image descriptions to open in their own windows and not behave as if they are part of the image slideshow. This is probably a dumb question, but is there a way to accomplish that without re-configuring all the code and css?
LVL 1
MarisaWeb DesignAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

lenamtlCommented:
Hi,

here is an example with  caption, animation and fading for owl carousel 2  
https://codepen.io/lenamtl/pen/EdYLRJ
0
leakim971PluritechnicianCommented:
<script>
     jQuery(function($) {
              $(".owl-stage-outer").on("click",".gallery_item_info a", function(event) { 
                      event.preventDefault();
                      var href = $(this).attr("href");
                      window.open(href, "_blank");
              });
     });
</script>

Open in new window

0
Julian HansenCommented:
I am guessing the problem is in your static/js/main.js
$('.image-gallery').magnificPopup({
    delegate: 'a',
    type: 'image',
    fixedContentPos: true,
    gallery: {
        enabled: true
    },
    removalDelay: 300,
    mainClass: 'mfp-fade',
    retina: {
        ratio: 1,
        replaceSrc: function(item, ratio) {
            return item.src.replace(/\.\w+$/, function(m) {
                return '@2x' + m;
            });
        }
    }
});
$('.image-gallery2').magnificPopup({
    delegate: 'a',
    type: 'image',
    fixedContentPos: true,
    gallery: {
        enabled: true
    },
    removalDelay: 300,
    mainClass: 'mfp-fade',
    retina: {
        ratio: 1,
        replaceSrc: function(item, ratio) {
            return item.src.replace(/\.\w+$/, function(m) {
                return '@2x' + m;
            });
        }
    }
})

Open in new window

I have unpacked the code but it appears that you are binding magificPopup twice with the same data - not the problem in itself but something to fix.

Next if you look at what you are doing - you are binding magnificPopup to all <a> elements in the container with class .image-gallery - which is your carousel container.

All you need to do - after you have removed the duplicate binding is just change the delegate to specifically reference the <a> elements that contain images.

I notice you have the h_lightbox class on image links so you could do this

$('.image-gallery').magnificPopup({
    delegate: 'a.h_lightbox',
    type: 'image',
    fixedContentPos: true,
    gallery: {
        enabled: true
    },
    removalDelay: 300,
    mainClass: 'mfp-fade',
    retina: {
        ratio: 1,
        replaceSrc: function(item, ratio) {
            return item.src.replace(/\.\w+$/, function(m) {
                return '@2x' + m;
            });
        }
    }
});

Open in new window


You can change the h_lightbox class for any class you want - just add the class to the image <a> element and then change the above code.

EDIT:
Correction: you do not have the binding twice - you are binding it to two different classes .image-gallery and .image-gallery2 - so you just need to make the change to the first item
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
CSS

From novice to tech pro — start learning today.