PluginProbe
Easy Elements for Elementor – Addons & Website Templates / 1.5.0
Easy Elements for Elementor – Addons & Website Templates v1.5.0
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 / widgets / offcanvas / js / offcanvas.js

offcanvas.js in Easy Elements for Elementor – Addons & Website Templates 1.5.0, at widgets/offcanvas/js/offcanvas.js

84 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function($){
2 $(document).on('click', '.eel-offcanvas-toggle', function(e){
3 e.stopPropagation();
4 var target = $(this).data('target');
5 var $offcanvas = $(target);
6 if (!$offcanvas.data('initialized')) {
7 $offcanvas.data('initialized', true);
8 if (!$offcanvas.hasClass('modern')) {
9 if ($offcanvas.hasClass('eel-offcanvas-left')) {
10 $offcanvas.css('transform', 'translateX(-100%)');
11 } else {
12 $offcanvas.css('transform', 'translateX(100%)');
13 }
14 } else {
15 $offcanvas.css({'visibility':'hidden','opacity':'0'});
16 }
17 }
18
19 // toggle active
20 if ($offcanvas.hasClass('active')) {
21 $offcanvas.removeClass('active');
22 $('body').removeClass('eel-offcanvas-active');
23
24 if (!$offcanvas.hasClass('modern')) {
25 if ($offcanvas.hasClass('eel-offcanvas-left')) {
26 $offcanvas.css('transform', 'translateX(-100%)');
27 } else {
28 $offcanvas.css('transform', 'translateX(100%)');
29 }
30 } else {
31 $offcanvas.css({'visibility':'hidden','opacity':'0'});
32 }
33 } else {
34 $('.eel-offcanvas').each(function(){
35 var $other = $(this);
36 if ($other[0] !== $offcanvas[0]) {
37 $other.removeClass('active');
38 if (!$other.hasClass('modern')) {
39 if ($other.hasClass('eel-offcanvas-left')) {
40 $other.css('transform','translateX(-100%)');
41 } else {
42 $other.css('transform','translateX(100%)');
43 }
44 } else {
45 $other.css({'visibility':'hidden','opacity':'0'});
46 }
47 }
48 });
49
50 $offcanvas.addClass('active');
51 $('body').addClass('eel-offcanvas-active');
52
53 if (!$offcanvas.hasClass('modern')) {
54 $offcanvas.css('transform','translateX(0)');
55 } else {
56 $offcanvas.css({'visibility':'visible','opacity':'1'});
57 }
58 }
59 });
60
61 $(document).on('click', function(){
62 var $active = $('.eel-offcanvas.active');
63 if ($active.length) {
64 $active.removeClass('active');
65 $('body').removeClass('eel-offcanvas-active');
66
67 if (!$active.hasClass('modern')) {
68 if ($active.hasClass('eel-offcanvas-left')) {
69 $active.css('transform','translateX(-100%)');
70 } else {
71 $active.css('transform','translateX(100%)');
72 }
73 } else {
74 $active.css({'visibility':'hidden','opacity':'0'});
75 }
76 }
77 });
78
79 $(document).on('click', '.eel-offcanvas', function(e){
80 e.stopPropagation();
81 });
82
83 })(jQuery);
84