Currently, I have integrated a flickity.js carousel on my website and now I am looking to include some mailto
links within it. Unfortunately, the static clicks do not function as expected in the carousel by default, so I utilized the staticClick.flickity
event to capture these clicks:
https://codepen.io/Deka87/pen/zEJrLY
// Capture 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);
}
});
Although the href
value is obtained successfully, unfortunately the window.location.href
part does not seem to work properly, resulting in the mail client not being triggered. Any thoughts or suggestions on how this issue can be resolved?