PluginProbe
Easy Elements for Elementor – Addons & Website Templates / 1.3.6
Easy Elements for Elementor – Addons & Website Templates v1.3.6
1.5.3 1.5.2 1.5.1 1.5.0 1.4.9 1.4.6 1.4.7 1.4.8 1.4.5 1.4.4 1.4.3 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 All 47 releases
easy-elements / assets / js / easy-wrapper-link.js

easy-wrapper-link.js in Easy Elements for Elementor – Addons & Website Templates 1.3.6, at assets/js/easy-wrapper-link.js

60 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 jQuery(document).ready(function ($) {
2 'use strict';
3
4 let touchStartY = 0;
5 let touchMoved = false;
6
7 $('body')
8 .on('touchstart', '.easyel-wrapper-link', function (e) {
9 touchStartY = e.originalEvent.touches[0].clientY;
10 touchMoved = false;
11 })
12 .on('touchmove', '.easyel-wrapper-link', function (e) {
13 const currentY = e.originalEvent.touches[0].clientY;
14 if (Math.abs(currentY - touchStartY) > 10) {
15 touchMoved = true;
16 }
17 })
18 .on('touchend click', '.easyel-wrapper-link', function (e) {
19 if (touchMoved) {
20 // Scroll
21 return;
22 }
23
24 const $el = $(this);
25 const settings = $el.data('easyel-wrapper-link');
26
27 if (!settings || !settings.url) return;
28
29 const url = settings.url.trim();
30
31 // Anchor scroll
32 if (url.startsWith('#')) {
33 e.preventDefault();
34 const target = $(url);
35 if (target.length) {
36 $('html, body').animate(
37 { scrollTop: target.offset().top },
38 600
39 );
40 }
41 return;
42 }
43
44 // Mail / Tel
45 if (url.startsWith('mailto:') || url.startsWith('tel:')) {
46 window.location.href = url;
47 return;
48 }
49
50 if (!/^https?:\/\//i.test(url)) return;
51
52 e.preventDefault();
53
54 if (settings.is_external) {
55 window.open(url, '_blank', 'noopener,noreferrer');
56 } else {
57 window.location.href = url;
58 }
59 });
60 });