0

I have a flickity.js carousel set up on my website and I want to add a couple of mailto links to it. Static clicks do not work in the carousel by default, so I had to use staticClick.flickity event to catch it:

https://codepen.io/Deka87/pen/zEJrLY

// Catch click events
$(".carousel").on("staticClick.flickity", function(event, pointer) {
    var tagName = pointer.path[0].tagName;

    if (tagName == "A") {
        var href = pointer.path[0].href;
        window.location.href = href;
        alert(href);
    }
});

While the href value is retrived OK, the window.location.href part doesn't work for some reason, i.e. mail client is not triggered. Any ideas how to fix this?

sdvnksv
  • 9,350
  • 18
  • 56
  • 108

1 Answers1

0

Try window.open(href); This should work. Please try this.

madalinivascu
  • 32,064
  • 4
  • 39
  • 55
ankita patel
  • 4,201
  • 1
  • 13
  • 28