Premium Addons for Elementor - Version 3.5.6

Version Description

  • Tweak: Added Save to Browser History option to save current section ID in Vertical Scroll widget.
  • Tweak: Added Hover CSS Filters in Banner widget
Download this release

Release Info

Developer leap13
Plugin Icon 128x128 Premium Addons for Elementor
Version 3.5.6
Comparing to
See all releases

Code changes from version 3.5.5 to 3.5.6

admin/includes/version-control.php CHANGED
@@ -91,7 +91,7 @@ class Version_Control {
91
<tr class="pa-roll-row">
92
<th><?php echo __('Rollback Version', 'premium-addons-for-elementor'); ?></th>
93
<td>
94
- <div><?php echo sprintf( '<a target="_blank" href="%1$s" class="button pa-btn pa-rollback-button elementor-button-spinner">%2$s</a>', wp_nonce_url( admin_url( 'admin-post.php?action=premium_addons_rollback' ), 'premium_addons_rollback' ), __('Reinstall Version 3.5.4', 'premium-addons-for-elementor') ); ?></div>
95
<p class="pa-roll-desc">
96
<span><?php echo __('Warning: Please backup your database before making the rollback.', 'premium-addons-for-elementor'); ?></span>
97
</p>
91
<tr class="pa-roll-row">
92
<th><?php echo __('Rollback Version', 'premium-addons-for-elementor'); ?></th>
93
<td>
94
+ <div><?php echo sprintf( '<a target="_blank" href="%1$s" class="button pa-btn pa-rollback-button elementor-button-spinner">%2$s</a>', wp_nonce_url( admin_url( 'admin-post.php?action=premium_addons_rollback' ), 'premium_addons_rollback' ), __('Reinstall Version 3.5.5', 'premium-addons-for-elementor') ); ?></div>
95
<p class="pa-roll-desc">
96
<span><?php echo __('Warning: Please backup your database before making the rollback.', 'premium-addons-for-elementor'); ?></span>
97
</p>
assets/frontend/css/premium-addons.css CHANGED
@@ -3461,8 +3461,13 @@ button.premium-modal-box-modal-close {
3461
width: 100%;
3462
object-fit: fill;
3463
}
3464
- .premium-gallery-load-more.premium-gallery-btn-hidden {
3465
- display: none;
3466
}
3467
.premium-gallery-load-more .premium-gallery-load-more-btn {
3468
box-shadow: none;
3461
width: 100%;
3462
object-fit: fill;
3463
}
3464
+ .premium-img-gallery .premium-gallery-item-hidden {
3465
+ /* display: none;*/
3466
+ visibility: hidden;
3467
+ width: 0 !important;
3468
+ height: 0 !important;
3469
+ margin: 0 !important;
3470
+ padding: 0 !important;
3471
}
3472
.premium-gallery-load-more .premium-gallery-load-more-btn {
3473
box-shadow: none;
assets/frontend/js/premium-addons.js CHANGED
@@ -1,708 +1,853 @@
1
- (function($) {
2
- /****** Premium Progress Bar Handler ******/
3
- var PremiumProgressBarWidgetHandler = function($scope, $) {
4
- var progressbarElement = $scope
5
- .find(".premium-progressbar-progress-bar")
6
- .each(function() {
7
- var settings = $(this).data("settings"),
8
- length = settings["progress_length"],
9
- speed = settings["speed"];
10
-
11
- $(this).animate({ width: length + "%" }, speed);
12
- });
13
- };
14
-
15
- /****** Premium Progress Bar Scroll Handler *****/
16
- var PremiumProgressBarScrollWidgetHandler = function($scope, $) {
17
- elementorFrontend.waypoint(
18
- $scope,
19
- function() {
20
- PremiumProgressBarWidgetHandler($(this), $);
21
- },
22
- {
23
- offset: Waypoint.viewportHeight() - 150,
24
- triggerOnce: true
25
- }
26
- );
27
- };
28
-
29
- /****** Premium Video Box Handler ******/
30
- var PremiumVideoBoxWidgetHandler = function($scope, $) {
31
- var videoBoxElement = $scope.find(".premium-video-box-container"),
32
- videoContainer = videoBoxElement.find(".premium-video-box-video-container"),
33
- type = videoBoxElement.data("type"),
34
- video,
35
- vidSrc,
36
- checkRel;
37
- videoBoxElement.on("click", function() {
38
-
39
- if ("self" === type) {
40
- video = videoContainer.find("video");
41
- vidSrc = video.attr("src");
42
- $(video)
43
- .get(0)
44
- .play();
45
- videoContainer.css({
46
- opacity: "1",
47
- visibility: "visible"
48
- });
49
- } else {
50
- vidSrc = videoContainer.data("src");
51
- vidSrc = vidSrc + "&autoplay=1";
52
- var iframe = $( "<iframe/>" );
53
- checkRel = vidSrc.indexOf("rel=0");
54
- iframe.attr( 'src', vidSrc );
55
- iframe.attr( 'frameborder', '0' );
56
- iframe.attr( 'allowfullscreen', '1' );
57
- iframe.attr( 'allow', 'autoplay;encrypted-media;' );
58
- videoContainer.css("background", "#000");
59
- videoContainer.html( iframe );
60
- }
61
- videoBoxElement.find(".premium-video-box-image-container").remove();
62
-
63
- });
64
- };
65
-
66
- /****** Premium Grid Handler ******/
67
- var PremiumGridWidgetHandler = function($scope, $) {
68
- var galleryElement = $scope.find(".premium-gallery-container"),
69
- gridSettings = galleryElement.data("settings"),
70
- layout = gridSettings['img_size'],
71
- deviceType = $("body").data("elementor-device-mode"),
72
- loadMore = gridSettings['load_more'],
73
- columnWidth = null;
74
-
75
- if( layout === 'metro' ) {
76
- var suffix = "";
77
-
78
- if ( "tablet" === deviceType ) {
79
- suffix = "_tablet";
80
- } else if ( "mobile" === deviceType ) {
81
- suffix = "_mobile";
82
- }
83
- var gridWidth = galleryElement.width(),
84
- cellSize = Math.floor( ( gridWidth / 12 ) );
85
- galleryElement.find(".premium-gallery-item").each(function(index, item ) {
86
- var cells = $(item).data("metro")[ "cells" + suffix],
87
- vCells = $(item).data("metro")[ "vcells" + suffix];
88
- if ( '' == cells || undefined == cells ) {
89
- var cells = $(item).data("metro")[ "cells" ];
90
- }
91
- if ( '' == vCells || undefined == vCells ) {
92
- var vCells = $(item).data("metro")[ "vcells" ];
93
- }
94
- $( item ).css({
95
- "width": Math.ceil( cells * cellSize ),
96
- "height": Math.ceil( vCells * cellSize )
97
- } );
98
- });
99
-
100
- layout = 'masonry';
101
- columnWidth = cellSize;
102
- }
103
-
104
- galleryElement.imagesLoaded( function() {} ).done( function() {
105
- galleryElement.isotope({
106
- itemSelector: ".premium-gallery-item",
107
- percentPosition: true,
108
- animationOptions: {
109
- duration: 750,
110
- easing: "linear"
111
},
112
- filter: gridSettings["active_cat"],
113
- layoutMode: layout,
114
- masonry: {
115
- columnWidth: columnWidth
116
}
117
});
118
- });
119
-
120
- if ( loadMore ) {
121
-
122
- var minimum = gridSettings['minimum'],
123
- imageToShow = gridSettings['click_images'];
124
-
125
- galleryElement.parent().find('.premium-gallery-load-more div').hide();
126
- if ( galleryElement.find(".premium-gallery-item").length > minimum ) {
127
- galleryElement.parent().find('.premium-gallery-load-more').removeClass('premium-gallery-btn-hidden');
128
- galleryElement.find(".premium-gallery-item:gt(" + ( minimum - 1 ) + ")").hide();
129
- function appendItems( currentItems ) {
130
-
131
- var itemsToShow = $( currentItems ).filter(':hidden').slice( 0, imageToShow );
132
-
133
- if ( itemsToShow.length > 0 ) {
134
- itemsToShow.show();
135
- galleryElement.isotope('layout');
136
- }
137
-
138
}
139
- galleryElement.parent().on('click', '.premium-gallery-load-more-btn', function() {
140
- var currentFilterItems = galleryElement.isotope('getFilteredItemElements');
141
- $.ajax({
142
- url: appendItems( currentFilterItems ),
143
- beforeSend: function() {
144
- galleryElement.parent().find('.premium-gallery-load-more div').show();
145
},
146
- success: function() {
147
- var itemsLeft = $( currentFilterItems ).filter(':hidden').slice( 0, imageToShow );
148
- if ( itemsLeft.length > 0 ) {
149
- galleryElement.parent().find('.premium-gallery-load-more div').hide();
150
- } else {
151
- galleryElement.parent().find('.premium-gallery-load-more').hide();
152
- }
153
}
154
});
155
});
156
- }
157
- }
158
-
159
- $scope.find(".premium-gallery-cats-container li a").click(function(e) {
160
- e.preventDefault();
161
- //Showing all images of category
162
- $scope.find(".premium-gallery-cats-container li .active").removeClass("active");
163
- $(this).addClass("active");
164
- var selector = $(this).attr("data-filter");
165
- galleryElement.isotope({ filter: selector });
166
- return false;
167
- });
168
-
169
- $scope.find(".premium-img-gallery a[data-rel^='prettyPhoto']").prettyPhoto({
170
- theme: gridSettings['theme'],
171
- hook: "data-rel",
172
- opacity: 0.7,
173
- show_title: false,
174
- deeplinking: false,
175
- overlay_gallery: gridSettings['overlay_gallery'],
176
- custom_markup: "",
177
- default_width: 900,
178
- default_height: 506,
179
- social_tools: ""
180
- });
181
- };
182
-
183
- /****** Premium Counter Handler ******/
184
- var PremiumCounterHandler = function($scope, $) {
185
- var counterElement = $scope.find(".premium-counter");
186
- elementorFrontend.waypoint(counterElement, function () {
187
- var counterSettings = counterElement.data(),
188
- incrementElement = counterElement.find(".premium-counter-init"),
189
- iconElement = counterElement.find(".icon");
190
- $(incrementElement).numerator(counterSettings);
191
- $(iconElement).addClass( "animated " + iconElement.data("animation") );
192
- });
193
- };
194
-
195
- /****** Premium Fancy Text Handler ******/
196
- var PremiumFancyTextHandler = function($scope, $) {
197
- var fancyTextElement = $scope.find(".premium-fancy-text-wrapper");
198
- var fancyTextSettings = fancyTextElement.data("settings");
199
- function escapeHtml(unsafe) {
200
- return unsafe
201
- .replace(/&/g, "&amp;")
202
- .replace(/</g, "&lt;")
203
- .replace(/>/g, "&gt;")
204
- .replace(/"/g, "&quot;")
205
- .replace(/'/g, "&#039;");
206
- }
207
- if (fancyTextSettings["effect"] === "typing") {
208
- var fancyStrings = [];
209
- fancyTextSettings["strings"].forEach(function(item) {
210
- fancyStrings.push(escapeHtml(item));
211
- });
212
- fancyTextElement.find(".premium-fancy-text").typed({
213
- strings: fancyStrings,
214
- typeSpeed: fancyTextSettings["typeSpeed"],
215
- backSpeed: fancyTextSettings["backSpeed"],
216
- startDelay: fancyTextSettings["startDelay"],
217
- backDelay: fancyTextSettings["backDelay"],
218
- showCursor: fancyTextSettings["showCursor"],
219
- cursorChar: fancyTextSettings["cursorChar"],
220
- loop: fancyTextSettings["loop"]
221
- });
222
- } else {
223
- fancyTextElement.find(".premium-fancy-text").vTicker({
224
- speed: fancyTextSettings["speed"],
225
- showItems: fancyTextSettings["showItems"],
226
- pause: fancyTextSettings["pause"],
227
- mousePause: fancyTextSettings["mousePause"],
228
- direction: "up"
229
- });
230
- }
231
- };
232
-
233
- /****** Premium Countdown Handler ******/
234
- var PremiumCountDownHandler = function($scope, $) {
235
- var countDownElement = $scope.find(".premium-countdown").each(function() {
236
-
237
- var countDownSettings = $(this).data("settings");
238
-
239
- var label1 = countDownSettings["label1"],
240
- label2 = countDownSettings["label2"],
241
- newLabe1 = label1.split(","),
242
- newLabe2 = label2.split(",");
243
-
244
- if ( countDownSettings["event"] === "onExpiry" ) {
245
- $(this)
246
- .find(".premium-countdown-init")
247
- .pre_countdown({
248
- labels: newLabe2,
249
- labels1: newLabe1,
250
- until: new Date(countDownSettings["until"]),
251
- format: countDownSettings["format"],
252
- padZeroes: true,
253
- onExpiry: function() {
254
- $(this).html(countDownSettings["text"]);
255
- },
256
- serverSync: function() {
257
- return new Date(countDownSettings["serverSync"]);
258
- }
259
- });
260
- } else if (countDownSettings["event"] === "expiryUrl") {
261
- $(this)
262
- .find(".premium-countdown-init")
263
- .pre_countdown({
264
- labels: newLabe2,
265
- labels1: newLabe1,
266
- until: new Date(countDownSettings["until"]),
267
- format: countDownSettings["format"],
268
- padZeroes: true,
269
- expiryUrl: countDownSettings["text"],
270
- serverSync: function() {
271
- return new Date(countDownSettings["serverSync"]);
272
- }
273
- });
274
- }
275
- times = $(this)
276
- .find(".premium-countdown-init")
277
- .pre_countdown("getTimes");
278
- function runTimer(el) {
279
- return el == 0;
280
- }
281
- if (times.every(runTimer)) {
282
- if (countDownSettings["event"] === "onExpiry") {
283
- $(this)
284
- .find(".premium-countdown-init")
285
- .html(countDownSettings["text"]);
286
- }
287
- if (countDownSettings["event"] === "expiryUrl") {
288
- var editMode = $("body").find("#elementor").length;
289
- if (editMode > 0) {
290
- $(this)
291
- .find(".premium-countdown-init")
292
- .html(
293
- "<h1>You can not redirect url from elementor Editor!!</h1>"
294
- );
295
- } else {
296
- window.location.href = countDownSettings["text"];
297
- }
298
- }
299
- }
300
-
301
- });
302
- };
303
-
304
- /****** Premium Carousel Handler ******/
305
- var PremiumCarouselHandler = function( $scope, $ ) {
306
-
307
- var isEdit = elementorFrontend.isEditMode();
308
-
309
- var carouselElement = $scope.find(".premium-carousel-wrapper").each( function() {
310
- var $carouselElement = $(this);
311
- var carouselSettings = $( this ).data("settings");
312
-
313
- function slideToShow ( slick ) {
314
-
315
- slidesToShow = slick.options.slidesToShow;
316
-
317
- windowWidth = jQuery(window).width();
318
-
319
- if ( windowWidth > carouselSettings["tabletBreak"] ) {
320
- slidesToShow = carouselSettings["slidesDesk"];
321
- }
322
-
323
- if ( windowWidth <= carouselSettings["tabletBreak"] ) {
324
- slidesToShow = carouselSettings["slidesTab"];
325
- }
326
-
327
- if ( windowWidth <= carouselSettings["mobileBreak"] ) {
328
- slidesToShow = carouselSettings["slidesMob"];
329
- }
330
-
331
- return slidesToShow;
332
-
333
- }
334
-
335
- if ( isEdit ) {
336
-
337
- $( this ).find( '.item-wrapper' ).each( function( index, slide ) {
338
-
339
- var templateID = $( slide ).data('template');
340
-
341
- if ( undefined !== templateID ) {
342
- $.ajax({
343
- type: 'GET',
344
- url: PremiumProSettings.ajaxurl,
345
- dataType: 'html',
346
- data: {
347
- action: 'get_elementor_template_content',
348
- templateID: templateID
349
- }
350
- }).success( function( response ) {
351
352
- var data = JSON.parse( response ).data;
353
354
- if ( undefined !== data.template_content ) {
355
-
356
- $( slide ).html( data.template_content );
357
-
358
- $carouselElement.find(".premium-carousel-inner").slick('refresh');
359
}
360
361
});
362
- }
363
364
});
365
-
366
-
367
- // $( this ).find( ".premium-carousel-inner" ).slick( 'refresh' );
368
}
369
-
370
- $( this ).on("init", function( event ) {
371
-
372
- event.preventDefault();
373
-
374
- $( this ).find("item-wrapper.slick-active").each(function() {
375
-
376
- $this = $( this );
377
- $this.addClass($this.data("animation"));
378
});
379
-
380
- $(".slick-track").addClass("translate");
381
-
382
- });
383
-
384
- $( this ).find(".premium-carousel-inner").slick({
385
- vertical: carouselSettings["vertical"],
386
- slidesToScroll: carouselSettings["slidesToScroll"],
387
- slidesToShow: carouselSettings["slidesToShow"],
388
- responsive: [
389
- {
390
- breakpoint: carouselSettings["tabletBreak"],
391
- settings: {
392
- slidesToShow: carouselSettings["slidesTab"],
393
- slidesToScroll: carouselSettings["slidesTab"]
394
}
395
- },
396
- {
397
- breakpoint: carouselSettings["mobileBreak"],
398
- settings: {
399
- slidesToShow: carouselSettings["slidesMob"],
400
- slidesToScroll: carouselSettings["slidesMob"]
401
}
402
- }
403
- ],
404
- fade: carouselSettings["fade"],
405
- infinite: carouselSettings["infinite"],
406
- speed: carouselSettings["speed"],
407
- autoplay: carouselSettings["autoplay"],
408
- autoplaySpeed: carouselSettings["autoplaySpeed"],
409
- draggable: carouselSettings["draggable"],
410
- touchMove: carouselSettings["touchMove"],
411
- rtl: carouselSettings["rtl"],
412
- useTransform: true,
413
- adaptiveHeight: carouselSettings["adaptiveHeight"],
414
- pauseOnHover: carouselSettings["pauseOnHover"],
415
- centerMode: carouselSettings["centerMode"],
416
- centerPadding: carouselSettings["centerPadding"],
417
- arrows: carouselSettings["arrows"],
418
- nextArrow: carouselSettings["nextArrow"],
419
- prevArrow: carouselSettings["prevArrow"],
420
- dots: carouselSettings["dots"],
421
- customPaging: function( slider, i ) {
422
- return '<i class="' + carouselSettings["customPaging"] + '"></i>';
423
- }
424
- });
425
-
426
- $( this ).on("afterChange", function( event, slick, currentSlide, nextSlide ) {
427
-
428
- slidesScrolled = slick.options.slidesToScroll;
429
- slidesToShow = slideToShow(slick);
430
- centerMode = slick.options.centerMode;
431
- $currentParent = slick.$slider[0].parentElement.id;
432
- slideToAnimate = currentSlide + slidesToShow - 1;
433
- if (slidesScrolled == 1) {
434
- if (centerMode == true) {
435
- animate = slideToAnimate - 2;
436
- $inViewPort = $(this).find("[data-slick-index='" + animate + "']");
437
- //$inViewPort.addClass($inViewPort.data("animation"));
438
- } else {
439
- $inViewPort = $(this).find("[data-slick-index='" +slideToAnimate +"']");
440
- if( 'null' != carouselSettings["animation"] ) {
441
- $inViewPort.find('p, h1, h2, h3, h4, h5, h6, span, a, img, i, button').addClass(carouselSettings["animation"]).removeClass("premium-carousel-content-hidden");
442
- }
443
-
444
- }
445
- } else {
446
- for (var i = slidesScrolled + currentSlide; i >= 0; i--) {
447
- $inViewPort = $(this).find("[data-slick-index='" + i + "']"
448
- );
449
- if( 'null' != carouselSettings["animation"] ) {
450
- $inViewPort.find('p, h1, h2, h3, h4, h5, h6, span, a, img, i, button').addClass(carouselSettings["animation"]).removeClass("premium-carousel-content-hidden");
451
}
452
}
453
- }
454
- });
455
-
456
- $(this).on("beforeChange", function(event, slick, currentSlide) {
457
- $inViewPort = $(this).find("[data-slick-index='" + currentSlide + "']");
458
- if( 'null' != carouselSettings["animation"] ) {
459
- $inViewPort.siblings().find('p, h1, h2, h3, h4, h5, h6, span, a, img, i, button').removeClass(carouselSettings["animation"]).addClass("premium-carousel-content-hidden");
460
- }
461
- });
462
- if (carouselSettings["vertical"]) {
463
- var maxHeight = -1;
464
- $(".slick-slide").each(function() {
465
- if ($(this).height() > maxHeight) {
466
- maxHeight = $(this).height();
467
- }
468
- });
469
- $(".slick-slide").each(function() {
470
- if ($(this).height() < maxHeight) {
471
- $(this).css(
472
- "margin",
473
- Math.ceil((maxHeight - $(this).height()) / 2) + "px 0"
474
- );
475
}
476
- });
477
}
478
- var marginFix = {
479
- element: $("a.ver-carousel-arrow"),
480
- getWidth: function() {
481
- var width = this.element.outerWidth();
482
- return width / 2;
483
- },
484
- setWidth: function(type) {
485
- type = type || "vertical";
486
- if (type == "vertical") {
487
- this.element.css("margin-left", "-" + this.getWidth() + "px");
488
- } else {
489
- this.element.css("margin-top", "-" + this.getWidth() + "px");
490
- }
491
- }
492
- };
493
- marginFix.setWidth();
494
- marginFix.element = $("a.carousel-arrow");
495
- marginFix.setWidth("horizontal");
496
- });
497
-
498
- };
499
-
500
- /****** Premium Banner Handler ******/
501
- var PremiumBannerHandler = function($scope, $) {
502
- var bannerElement = $scope.find(".premium-banner");
503
- bannerElement.find(".premium-banner-ib").hover(
504
- function() {
505
- $(this)
506
- .find(".premium-banner-ib-img")
507
- .addClass("active");
508
- },
509
- function() {
510
- $(this)
511
- .find(".premium-banner-ib-img")
512
- .removeClass("active");
513
- }
514
- );
515
- };
516
-
517
- /****** Premium Modal Box Handler ******/
518
- var PremiumModalBoxHandler = function($scope, $) {
519
- var modalBoxElement = $scope.find(".premium-modal-box-container"),
520
- modalBoxSettings = modalBoxElement.data("settings");
521
-
522
- if (modalBoxElement.length > 0) {
523
- if (modalBoxSettings["trigger"] === "pageload") {
524
- $(document).ready(function($) {
525
- setTimeout(function() {
526
- modalBoxElement.find(".premium-modal-box-modal").modal();
527
- }, modalBoxSettings["delay"] * 1000);
528
- });
529
- }
530
- }
531
- };
532
-
533
- /****** Premium Blog Handler ******/
534
- var PremiumBlogHandler = function($scope, $) {
535
- var blogElement = $scope.find(".premium-blog-wrap"),
536
- masonryBlog = blogElement.data("pa-masonry"),
537
- colsNumber = blogElement.data("col"),
538
- carousel = blogElement.data("carousel"),
539
- autoPlay = blogElement.data("play"),
540
- speed = blogElement.data("speed"),
541
- fade = blogElement.data("fade"),
542
- prevArrow =
543
- '<a type="button" data-role="none" class="carousel-arrow carousel-prev" aria-label="Next" role="button" style=""><i class="fa fa-angle-left" aria-hidden="true"></i></a>',
544
- nextArrow =
545
- '<a type="button" data-role="none" class="carousel-arrow carousel-next" aria-label="Next" role="button" style=""><i class="fa fa-angle-right" aria-hidden="true"></i></a>';
546
-
547
- $scope.find(".premium-blog-cats-container li a").click(function(e) {
548
- e.preventDefault();
549
-
550
- $scope.find(".premium-blog-cats-container li .active").removeClass("active");
551
-
552
- $(this).addClass("active");
553
-
554
- var selector = $(this).attr("data-filter");
555
- console.log(selector);
556
- blogElement.isotope({ filter: selector });
557
-
558
- return false;
559
- });
560
561
- if (masonryBlog) {
562
- blogElement.imagesLoaded(function() {
563
- blogElement.isotope({
564
- itemSelector: ".premium-blog-post-container",
565
- percentPosition: true,
566
- animationOptions: {
567
- duration: 750,
568
- easing: "linear",
569
- queue: false
570
- }
571
});
572
- });
573
- }
574
-
575
- if ( carousel && ! masonryBlog ) {
576
- $(blogElement).slick({
577
- infinite: true,
578
- slidesToShow: colsNumber,
579
- slidesToScroll: colsNumber,
580
- responsive: [
581
- { breakpoint: 769, settings: { slidesToShow: 1, slidesToScroll: 1 } },
582
- { breakpoint: 481, settings: { slidesToShow: 1, slidesToScroll: 1 } }
583
- ],
584
- autoplay: autoPlay,
585
- autoplaySpeed: speed,
586
- nextArrow: nextArrow,
587
- prevArrow: prevArrow,
588
- fade: fade,
589
- draggable: true
590
- });
591
- }
592
-
593
- };
594
-
595
- /****** Premium Image Scroll ******/
596
- var PremiumImageScrollHandler = function($scope, $) {
597
- var scrollElement = $scope.find(".premium-image-scroll-container"),
598
- scrollOverlay = scrollElement.find(".premium-image-scroll-overlay"),
599
- scrollVertical = scrollElement.find(".premium-image-scroll-vertical"),
600
- dataElement = scrollElement.data("settings"),
601
- imageScroll = scrollElement.find('.premium-image-scroll-image'),
602
- direction = dataElement['direction'],
603
- reverse = dataElement['reverse'],
604
- transformOffset = null;
605
-
606
function startTransform() {
607
- imageScroll.css("transform", (direction === "vertical" ? "translateY" : "translateX") + "( -" + transformOffset + "px)");
608
}
609
-
610
function endTransform() {
611
- imageScroll.css("transform", (direction === 'vertical' ? "translateY" : "translateX") + "(0px)");
612
}
613
-
614
function setTransform() {
615
- if( direction === "vertical" ) {
616
transformOffset = imageScroll.height() - scrollElement.height();
617
} else {
618
transformOffset = imageScroll.width() - scrollElement.width();
619
}
620
}
621
-
622
- if( dataElement["trigger"] === "scroll" ) {
623
scrollElement.addClass("premium-container-scroll");
624
- if ( direction === "vertical" ) {
625
scrollVertical.addClass("premium-image-scroll-ver");
626
} else {
627
- scrollElement.imagesLoaded(function() {
628
- scrollOverlay.css( { "width": imageScroll.width(), "height": imageScroll.height() } );
629
});
630
}
631
} else {
632
- if ( reverse === 'yes' ) {
633
- scrollElement.imagesLoaded(function() {
634
scrollElement.addClass("premium-container-scroll-instant");
635
setTransform();
636
startTransform();
637
});
638
}
639
- if ( direction === "vertical" ) {
640
scrollVertical.removeClass("premium-image-scroll-ver");
641
}
642
- scrollElement.mouseenter(function() {
643
scrollElement.removeClass("premium-container-scroll-instant");
644
setTransform();
645
- reverse === 'yes' ? endTransform() : startTransform();
646
});
647
648
- scrollElement.mouseleave(function() {
649
- reverse === 'yes' ? startTransform() : endTransform();
650
});
651
}
652
};
653
654
- //Elementor JS Hooks
655
- $(window).on("elementor/frontend/init", function() {
656
- elementorFrontend.hooks.addAction(
657
- "frontend/element_ready/premium-addon-video-box.default",
658
- PremiumVideoBoxWidgetHandler
659
- );
660
- elementorFrontend.hooks.addAction(
661
- "frontend/element_ready/premium-img-gallery.default",
662
- PremiumGridWidgetHandler
663
- );
664
- elementorFrontend.hooks.addAction(
665
- "frontend/element_ready/premium-addon-fancy-text.default",
666
- PremiumFancyTextHandler
667
- );
668
- elementorFrontend.hooks.addAction(
669
- "frontend/element_ready/premium-counter.default",
670
- PremiumCounterHandler
671
- );
672
- elementorFrontend.hooks.addAction(
673
- "frontend/element_ready/premium-countdown-timer.default",
674
- PremiumCountDownHandler
675
- );
676
- elementorFrontend.hooks.addAction(
677
- "frontend/element_ready/premium-carousel-widget.default",
678
- PremiumCarouselHandler
679
- );
680
- elementorFrontend.hooks.addAction(
681
- "frontend/element_ready/premium-addon-banner.default",
682
- PremiumBannerHandler
683
- );
684
- elementorFrontend.hooks.addAction(
685
- "frontend/element_ready/premium-addon-modal-box.default",
686
- PremiumModalBoxHandler
687
- );
688
- elementorFrontend.hooks.addAction(
689
- "frontend/element_ready/premium-addon-blog.default",
690
- PremiumBlogHandler
691
- );
692
- elementorFrontend.hooks.addAction(
693
- "frontend/element_ready/premium-image-scroll.default",
694
- PremiumImageScrollHandler
695
- );
696
- if (elementorFrontend.isEditMode()) {
697
- elementorFrontend.hooks.addAction(
698
- "frontend/element_ready/premium-addon-progressbar.default",
699
- PremiumProgressBarWidgetHandler
700
- );
701
- } else {
702
- elementorFrontend.hooks.addAction(
703
- "frontend/element_ready/premium-addon-progressbar.default",
704
- PremiumProgressBarScrollWidgetHandler
705
- );
706
- }
707
- });
708
- })(jQuery);
1
+ (function ($) {
2
+ /****** Premium Progress Bar Handler ******/
3
+ var PremiumProgressBarWidgetHandler = function ($scope, $) {
4
+ var progressbarElement = $scope
5
+ .find(".premium-progressbar-progress-bar")
6
+ .each(function () {
7
+ var settings = $(this).data("settings"),
8
+ length = settings["progress_length"],
9
+ speed = settings["speed"];
10
+
11
+ $(this).animate({ width: length + "%" }, speed);
12
+ });
13
+ };
14
+
15
+ /****** Premium Progress Bar Scroll Handler *****/
16
+ var PremiumProgressBarScrollWidgetHandler = function ($scope, $) {
17
+ elementorFrontend.waypoint(
18
+ $scope,
19
+ function () {
20
+ PremiumProgressBarWidgetHandler($(this), $);
21
},
22
+ {
23
+ offset: Waypoint.viewportHeight() - 150,
24
+ triggerOnce: true
25
}
26
+ );
27
+ };
28
+
29
+ /****** Premium Video Box Handler ******/
30
+ var PremiumVideoBoxWidgetHandler = function ($scope, $) {
31
+ var videoBoxElement = $scope.find(".premium-video-box-container"),
32
+ videoContainer = videoBoxElement.find(
33
+ ".premium-video-box-video-container"
34
+ ),
35
+ type = videoBoxElement.data("type"),
36
+ video,
37
+ vidSrc,
38
+ checkRel;
39
+ videoBoxElement.on("click", function () {
40
+ if ("self" === type) {
41
+ video = videoContainer.find("video");
42
+ vidSrc = video.attr("src");
43
+ $(video)
44
+ .get(0)
45
+ .play();
46
+ videoContainer.css({
47
+ opacity: "1",
48
+ visibility: "visible"
49
+ });
50
+ } else {
51
+ vidSrc = videoContainer.data("src");
52
+ vidSrc = vidSrc + "&autoplay=1";
53
+ var iframe = $("<iframe/>");
54
+ checkRel = vidSrc.indexOf("rel=0");
55
+ iframe.attr("src", vidSrc);
56
+ iframe.attr("frameborder", "0");
57
+ iframe.attr("allowfullscreen", "1");
58
+ iframe.attr("allow", "autoplay;encrypted-media;");
59
+ videoContainer.css("background", "#000");
60
+ videoContainer.html(iframe);
61
+ }
62
+ videoBoxElement.find(".premium-video-box-image-container").remove();
63
});
64
+ };
65
+
66
+ /****** Premium Grid Handler ******/
67
+ var PremiumGridWidgetHandler = function ($scope, $) {
68
+ var galleryElement = $scope.find(".premium-gallery-container"),
69
+ gridSettings = galleryElement.data("settings"),
70
+ layout = gridSettings["img_size"],
71
+ deviceType = $("body").data("elementor-device-mode"),
72
+ loadMore = gridSettings["load_more"],
73
+ columnWidth = null,
74
+ filter = null,
75
+ isFilterClicked = false,
76
+ minimum = gridSettings["minimum"],
77
+ imageToShow = gridSettings["click_images"],
78
+ counter = minimum;
79
+
80
+ if (layout === "metro") {
81
+ var suffix = "";
82
+
83
+ if ("tablet" === deviceType) {
84
+ suffix = "_tablet";
85
+ } else if ("mobile" === deviceType) {
86
+ suffix = "_mobile";
87
}
88
+ var gridWidth = galleryElement.width(),
89
+ cellSize = Math.floor(gridWidth / 12);
90
+ galleryElement
91
+ .find(".premium-gallery-item")
92
+ .each(function (index, item) {
93
+ var cells = $(item).data("metro")["cells" + suffix],
94
+ vCells = $(item).data("metro")["vcells" + suffix];
95
+ if ("" == cells || undefined == cells) {
96
+ var cells = $(item).data("metro")["cells"];
97
+ }
98
+ if ("" == vCells || undefined == vCells) {
99
+ var vCells = $(item).data("metro")["vcells"];
100
+ }
101
+ $(item).css({
102
+ width: Math.ceil(cells * cellSize),
103
+ height: Math.ceil(vCells * cellSize)
104
+ });
105
+ });
106
+
107
+ layout = "masonry";
108
+ columnWidth = cellSize;
109
+ }
110
+
111
+ galleryElement
112
+ .imagesLoaded(function () { })
113
+ .done(function () {
114
+ galleryElement.isotope({
115
+ itemSelector: ".premium-gallery-item",
116
+ percentPosition: true,
117
+ animationOptions: {
118
+ duration: 750,
119
+ easing: "linear"
120
},
121
+ filter: gridSettings["active_cat"],
122
+ layoutMode: layout,
123
+ masonry: {
124
+ columnWidth: columnWidth
125
}
126
});
127
});
128
+
129
+ if (loadMore) {
130
+
131
+ galleryElement
132
+ .parent()
133
+ .find(".premium-gallery-load-more div")
134
+ .addClass("premium-gallery-item-hidden");
135
+ if (galleryElement.find(".premium-gallery-item").length > minimum) {
136
+ galleryElement
137
+ .parent()
138
+ .find(".premium-gallery-load-more")
139
+ .removeClass("premium-gallery-item-hidden");
140
+ galleryElement
141
+ .find(".premium-gallery-item:gt(" + (minimum - 1) + ")")
142
+ .addClass("premium-gallery-item-hidden");
143
+
144
+ function appendItems( imagesToShow ) {
145
+
146
+ var instance = galleryElement.data('isotope');
147
+
148
+ galleryElement.find(".premium-gallery-item-hidden").removeClass("premium-gallery-item-hidden");
149
+
150
+ galleryElement.parent().find(".premium-gallery-load-more").removeClass("premium-gallery-item-hidden");
151
+
152
+ var itemsToHide = instance.filteredItems.slice( imagesToShow, instance.filteredItems.length ).map(function( item ) {
153
+ return item.element;
154
+ });
155
+
156
+ $( itemsToHide ).addClass("premium-gallery-item-hidden");
157
+
158
+ galleryElement.isotope("layout");
159
+
160
+ if( 0 == itemsToHide ) {
161
+
162
+ galleryElement
163
+ .parent()
164
+ .find(".premium-gallery-load-more")
165
+ .addClass(
166
+ "premium-gallery-item-hidden"
167
+ );
168
169
+ }
170
+
171
+ }
172
173
+ galleryElement
174
+ .parent()
175
+ .on("click", ".premium-gallery-load-more-btn", function () {
176
+
177
+ if ( isFilterClicked ) {
178
+ counter = minimum;
179
+ isFilterClicked = false;
180
+ } else {
181
+ counter = counter;
182
}
183
184
+ counter = counter + imageToShow;
185
+ console.log(counter);
186
+ $.ajax({
187
+ url: appendItems( counter ),
188
+ beforeSend: function () {
189
+ galleryElement
190
+ .parent()
191
+ .find(".premium-gallery-load-more div")
192
+ .removeClass("premium-gallery-item-hidden");
193
+ },
194
+ success: function () {
195
+ galleryElement
196
+ .parent()
197
+ .find(".premium-gallery-load-more div")
198
+ .addClass("premium-gallery-item-hidden");
199
+ }
200
+ });
201
});
202
+ }
203
+ }
204
+
205
+
206
+ $scope.find(".premium-gallery-cats-container li a").click(function (e) {
207
+ e.preventDefault();
208
+
209
+ isFilterClicked = true;
210
+
211
+ //Showing all images of category
212
+ $scope
213
+ .find(".premium-gallery-cats-container li .active")
214
+ .removeClass("active");
215
+
216
+ $(this).addClass("active");
217
+
218
+ filter = $(this).attr("data-filter");
219
+
220
+ galleryElement.isotope({ filter: filter });
221
222
+ if (loadMore)
223
+ appendItems( minimum );
224
+
225
+ return false;
226
+ });
227
+
228
+ $scope
229
+ .find(".premium-img-gallery a[data-rel^='prettyPhoto']")
230
+ .prettyPhoto({
231
+ theme: gridSettings["theme"],
232
+ hook: "data-rel",
233
+ opacity: 0.7,
234
+ show_title: false,
235
+ deeplinking: false,
236
+ overlay_gallery: gridSettings["overlay_gallery"],
237
+ custom_markup: "",
238
+ default_width: 900,
239
+ default_height: 506,
240
+ social_tools: ""
241
});
242
+ };
243
+
244
+ /****** Premium Counter Handler ******/
245
+ var PremiumCounterHandler = function ($scope, $) {
246
+ var counterElement = $scope.find(".premium-counter");
247
+ elementorFrontend.waypoint(counterElement, function () {
248
+ var counterSettings = counterElement.data(),
249
+ incrementElement = counterElement.find(".premium-counter-init"),
250
+ iconElement = counterElement.find(".icon");
251
+ $(incrementElement).numerator(counterSettings);
252
+ $(iconElement).addClass(
253
+ "animated " + iconElement.data("animation")
254
+ );
255
+ });
256
+ };
257
+
258
+ /****** Premium Fancy Text Handler ******/
259
+ var PremiumFancyTextHandler = function ($scope, $) {
260
+ var fancyTextElement = $scope.find(".premium-fancy-text-wrapper");
261
+ var fancyTextSettings = fancyTextElement.data("settings");
262
+ function escapeHtml(unsafe) {
263
+ return unsafe
264
+ .replace(/&/g, "&amp;")
265
+ .replace(/</g, "&lt;")
266
+ .replace(/>/g, "&gt;")
267
+ .replace(/"/g, "&quot;")
268
+ .replace(/'/g, "&#039;");
269
}
270
+ if (fancyTextSettings["effect"] === "typing") {
271
+ var fancyStrings = [];
272
+ fancyTextSettings["strings"].forEach(function (item) {
273
+ fancyStrings.push(escapeHtml(item));
274
});
275
+ fancyTextElement.find(".premium-fancy-text").typed({
276
+ strings: fancyStrings,
277
+ typeSpeed: fancyTextSettings["typeSpeed"],
278
+ backSpeed: fancyTextSettings["backSpeed"],
279
+ startDelay: fancyTextSettings["startDelay"],
280
+ backDelay: fancyTextSettings["backDelay"],
281
+ showCursor: fancyTextSettings["showCursor"],
282
+ cursorChar: fancyTextSettings["cursorChar"],
283
+ loop: fancyTextSettings["loop"]
284
+ });
285
+ } else {
286
+ fancyTextElement.find(".premium-fancy-text").vTicker({
287
+ speed: fancyTextSettings["speed"],
288
+ showItems: fancyTextSettings["showItems"],
289
+ pause: fancyTextSettings["pause"],
290
+ mousePause: fancyTextSettings["mousePause"],
291
+ direction: "up"
292
+ });
293
+ }
294
+ };
295
+
296
+ /****** Premium Countdown Handler ******/
297
+ var PremiumCountDownHandler = function ($scope, $) {
298
+ var countDownElement = $scope
299
+ .find(".premium-countdown")
300
+ .each(function () {
301
+ var countDownSettings = $(this).data("settings");
302
+
303
+ var label1 = countDownSettings["label1"],
304
+ label2 = countDownSettings["label2"],
305
+ newLabe1 = label1.split(","),
306
+ newLabe2 = label2.split(",");
307
+
308
+ if (countDownSettings["event"] === "onExpiry") {
309
+ $(this)
310
+ .find(".premium-countdown-init")
311
+ .pre_countdown({
312
+ labels: newLabe2,
313
+ labels1: newLabe1,
314
+ until: new Date(countDownSettings["until"]),
315
+ format: countDownSettings["format"],
316
+ padZeroes: true,
317
+ onExpiry: function () {
318
+ $(this).html(countDownSettings["text"]);
319
+ },
320
+ serverSync: function () {
321
+ return new Date(
322
+ countDownSettings["serverSync"]
323
+ );
324
+ }
325
+ });
326
+ } else if (countDownSettings["event"] === "expiryUrl") {
327
+ $(this)
328
+ .find(".premium-countdown-init")
329
+ .pre_countdown({
330
+ labels: newLabe2,
331
+ labels1: newLabe1,
332
+ until: new Date(countDownSettings["until"]),
333
+ format: countDownSettings["format"],
334
+ padZeroes: true,
335
+ expiryUrl: countDownSettings["text"],
336
+ serverSync: function () {
337
+ return new Date(
338
+ countDownSettings["serverSync"]
339
+ );
340
+ }
341
+ });
342
}
343
+ times = $(this)
344
+ .find(".premium-countdown-init")
345
+ .pre_countdown("getTimes");
346
+ function runTimer(el) {
347
+ return el == 0;
348
}
349
+ if (times.every(runTimer)) {
350
+ if (countDownSettings["event"] === "onExpiry") {
351
+ $(this)
352
+ .find(".premium-countdown-init")
353
+ .html(countDownSettings["text"]);
354
+ }
355
+ if (countDownSettings["event"] === "expiryUrl") {
356
+ var editMode = $("body").find("#elementor").length;
357
+ if (editMode > 0) {
358
+ $(this)
359
+ .find(".premium-countdown-init")
360
+ .html(
361
+ "<h1>You can not redirect url from elementor Editor!!</h1>"
362
+ );
363
+ } else {
364
+ window.location.href = countDownSettings["text"];
365
+ }
366
+ }
367
}
368
+ });
369
+ };
370
+
371
+ /****** Premium Carousel Handler ******/
372
+ var PremiumCarouselHandler = function ($scope, $) {
373
+ var isEdit = elementorFrontend.isEditMode();
374
+
375
+ var carouselElement = $scope
376
+ .find(".premium-carousel-wrapper")
377
+ .each(function () {
378
+ var $carouselElement = $(this);
379
+ var carouselSettings = $(this).data("settings");
380
+
381
+ function slideToShow(slick) {
382
+ slidesToShow = slick.options.slidesToShow;
383
+
384
+ windowWidth = jQuery(window).width();
385
+
386
+ if (windowWidth > carouselSettings["tabletBreak"]) {
387
+ slidesToShow = carouselSettings["slidesDesk"];
388
+ }
389
+
390
+ if (windowWidth <= carouselSettings["tabletBreak"]) {
391
+ slidesToShow = carouselSettings["slidesTab"];
392
+ }
393
+
394
+ if (windowWidth <= carouselSettings["mobileBreak"]) {
395
+ slidesToShow = carouselSettings["slidesMob"];
396
+ }
397
+
398
+ return slidesToShow;
399
+ }
400
+
401
+ if (isEdit) {
402
+ $(this)
403
+ .find(".item-wrapper")
404
+ .each(function (index, slide) {
405
+ var templateID = $(slide).data("template");
406
+
407
+ if (undefined !== templateID) {
408
+ $.ajax({
409
+ type: "GET",
410
+ url: PremiumProSettings.ajaxurl,
411
+ dataType: "html",
412
+ data: {
413
+ action:
414
+ "get_elementor_template_content",
415
+ templateID: templateID
416
+ }
417
+ }).success(function (response) {
418
+ var data = JSON.parse(response).data;
419
+
420
+ if (undefined !== data.template_content) {
421
+ $(slide).html(data.template_content);
422
+
423
+ $carouselElement
424
+ .find(".premium-carousel-inner")
425
+ .slick("refresh");
426
+ }
427
+ });
428
+ }
429
+ });
430
+
431
+ // $( this ).find( ".premium-carousel-inner" ).slick( 'refresh' );
432
+ }
433
+
434
+ $(this).on("init", function (event) {
435
+ event.preventDefault();
436
+
437
+ $(this)
438
+ .find("item-wrapper.slick-active")
439
+ .each(function () {
440
+ $this = $(this);
441
+ $this.addClass($this.data("animation"));
442
+ });
443
+
444
+ $(".slick-track").addClass("translate");
445
+ });
446
+
447
+ $(this)
448
+ .find(".premium-carousel-inner")
449
+ .slick({
450
+ vertical: carouselSettings["vertical"],
451
+ slidesToScroll: carouselSettings["slidesToScroll"],
452
+ slidesToShow: carouselSettings["slidesToShow"],
453
+ responsive: [
454
+ {
455
+ breakpoint: carouselSettings["tabletBreak"],
456
+ settings: {
457
+ slidesToShow: carouselSettings["slidesTab"],
458
+ slidesToScroll:
459
+ carouselSettings["slidesTab"]
460
+ }
461
+ },
462
+ {
463
+ breakpoint: carouselSettings["mobileBreak"],
464
+ settings: {
465
+ slidesToShow: carouselSettings["slidesMob"],
466
+ slidesToScroll:
467
+ carouselSettings["slidesMob"]
468
+ }
469
+ }
470
+ ],
471
+ fade: carouselSettings["fade"],
472
+ infinite: carouselSettings["infinite"],
473
+ speed: carouselSettings["speed"],
474
+ autoplay: carouselSettings["autoplay"],
475
+ autoplaySpeed: carouselSettings["autoplaySpeed"],
476
+ draggable: carouselSettings["draggable"],
477
+ touchMove: carouselSettings["touchMove"],
478
+ rtl: carouselSettings["rtl"],
479
+ useTransform: true,
480
+ adaptiveHeight: carouselSettings["adaptiveHeight"],
481
+ pauseOnHover: carouselSettings["pauseOnHover"],
482
+ centerMode: carouselSettings["centerMode"],
483
+ centerPadding: carouselSettings["centerPadding"],
484
+ arrows: carouselSettings["arrows"],
485
+ nextArrow: carouselSettings["nextArrow"],
486
+ prevArrow: carouselSettings["prevArrow"],
487
+ dots: carouselSettings["dots"],
488
+ customPaging: function (slider, i) {
489
+ return (
490
+ '<i class="' +
491
+ carouselSettings["customPaging"] +
492
+ '"></i>'
493
+ );
494
+ }
495
+ });
496
+
497
+ $(this).on("afterChange", function (
498
+ event,
499
+ slick,
500
+ currentSlide,
501
+ nextSlide
502
+ ) {
503
+ slidesScrolled = slick.options.slidesToScroll;
504
+ slidesToShow = slideToShow(slick);
505
+ centerMode = slick.options.centerMode;
506
+ $currentParent = slick.$slider[0].parentElement.id;
507
+ slideToAnimate = currentSlide + slidesToShow - 1;
508
+ if (slidesScrolled == 1) {
509
+ if (centerMode == true) {
510
+ animate = slideToAnimate - 2;
511
+ $inViewPort = $(this).find(
512
+ "[data-slick-index='" + animate + "']"
513
+ );
514
+ //$inViewPort.addClass($inViewPort.data("animation"));
515
+ } else {
516
+ $inViewPort = $(this).find(
517
+ "[data-slick-index='" + slideToAnimate + "']"
518
+ );
519
+ if ("null" != carouselSettings["animation"]) {
520
+ $inViewPort
521
+ .find(
522
+ "p, h1, h2, h3, h4, h5, h6, span, a, img, i, button"
523
+ )
524
+ .addClass(carouselSettings["animation"])
525
+ .removeClass(
526
+ "premium-carousel-content-hidden"
527
+ );
528
+ }
529
+ }
530
+ } else {
531
+ for (
532
+ var i = slidesScrolled + currentSlide;
533
+ i >= 0;
534
+ i--
535
+ ) {
536
+ $inViewPort = $(this).find(
537
+ "[data-slick-index='" + i + "']"
538
+ );
539
+ if ("null" != carouselSettings["animation"]) {
540
+ $inViewPort
541
+ .find(
542
+ "p, h1, h2, h3, h4, h5, h6, span, a, img, i, button"
543
+ )
544
+ .addClass(carouselSettings["animation"])
545
+ .removeClass(
546
+ "premium-carousel-content-hidden"
547
+ );
548
+ }
549
+ }
550
+ }
551
+ });
552
+
553
+ $(this).on("beforeChange", function (
554
+ event,
555
+ slick,
556
+ currentSlide
557
+ ) {
558
+ $inViewPort = $(this).find(
559
+ "[data-slick-index='" + currentSlide + "']"
560
+ );
561
+ if ("null" != carouselSettings["animation"]) {
562
+ $inViewPort
563
+ .siblings()
564
+ .find(
565
+ "p, h1, h2, h3, h4, h5, h6, span, a, img, i, button"
566
+ )
567
+ .removeClass(carouselSettings["animation"])
568
+ .addClass("premium-carousel-content-hidden");
569
+ }
570
+ });
571
+ if (carouselSettings["vertical"]) {
572
+ var maxHeight = -1;
573
+ $(".slick-slide").each(function () {
574
+ if ($(this).height() > maxHeight) {
575
+ maxHeight = $(this).height();
576
+ }
577
+ });
578
+ $(".slick-slide").each(function () {
579
+ if ($(this).height() < maxHeight) {
580
+ $(this).css(
581
+ "margin",
582
+ Math.ceil((maxHeight - $(this).height()) / 2) +
583
+ "px 0"
584
+ );
585
+ }
586
+ });
587
+ }
588
+ var marginFix = {
589
+ element: $("a.ver-carousel-arrow"),
590
+ getWidth: function () {
591
+ var width = this.element.outerWidth();
592
+ return width / 2;
593
+ },
594
+ setWidth: function (type) {
595
+ type = type || "vertical";
596
+ if (type == "vertical") {
597
+ this.element.css(
598
+ "margin-left",
599
+ "-" + this.getWidth() + "px"
600
+ );
601
+ } else {
602
+ this.element.css(
603
+ "margin-top",
604
+ "-" + this.getWidth() + "px"
605
+ );
606
+ }
607
+ }
608
+ };
609
+ marginFix.setWidth();
610
+ marginFix.element = $("a.carousel-arrow");
611
+ marginFix.setWidth("horizontal");
612
+ });
613
+ };
614
+
615
+ /****** Premium Banner Handler ******/
616
+ var PremiumBannerHandler = function ($scope, $) {
617
+ var bannerElement = $scope.find(".premium-banner");
618
+ bannerElement.find(".premium-banner-ib").hover(
619
+ function () {
620
+ $(this)
621
+ .find(".premium-banner-ib-img")
622
+ .addClass("active");
623
+ },
624
+ function () {
625
+ $(this)
626
+ .find(".premium-banner-ib-img")
627
+ .removeClass("active");
628
}
629
+ );
630
+ };
631
+
632
+ /****** Premium Modal Box Handler ******/
633
+ var PremiumModalBoxHandler = function ($scope, $) {
634
+ var modalBoxElement = $scope.find(".premium-modal-box-container"),
635
+ modalBoxSettings = modalBoxElement.data("settings");
636
+
637
+ if (modalBoxElement.length > 0) {
638
+ if (modalBoxSettings["trigger"] === "pageload") {
639
+ $(document).ready(function ($) {
640
+ setTimeout(function () {
641
+ modalBoxElement
642
+ .find(".premium-modal-box-modal")
643
+ .modal();
644
+ }, modalBoxSettings["delay"] * 1000);
645
+ });
646
}
647
}
648
+ };
649
+
650
+ /****** Premium Blog Handler ******/
651
+ var PremiumBlogHandler = function ($scope, $) {
652
+ var blogElement = $scope.find(".premium-blog-wrap"),
653
+ masonryBlog = blogElement.data("pa-masonry"),
654
+ colsNumber = blogElement.data("col"),
655
+ carousel = blogElement.data("carousel"),
656
+ autoPlay = blogElement.data("play"),
657
+ speed = blogElement.data("speed"),
658
+ fade = blogElement.data("fade"),
659
+ prevArrow =
660
+ '<a type="button" data-role="none" class="carousel-arrow carousel-prev" aria-label="Next" role="button" style=""><i class="fa fa-angle-left" aria-hidden="true"></i></a>',
661
+ nextArrow =
662
+ '<a type="button" data-role="none" class="carousel-arrow carousel-next" aria-label="Next" role="button" style=""><i class="fa fa-angle-right" aria-hidden="true"></i></a>';
663
+
664
+ $scope.find(".premium-blog-cats-container li a").click(function (e) {
665
+ e.preventDefault();
666
+
667
+ $scope
668
+ .find(".premium-blog-cats-container li .active")
669
+ .removeClass("active");
670
+
671
+ $(this).addClass("active");
672
+
673
+ var selector = $(this).attr("data-filter");
674
+ console.log(selector);
675
+ blogElement.isotope({ filter: selector });
676
677
+ return false;
678
});
679
+
680
+ if (masonryBlog) {
681
+ blogElement.imagesLoaded(function () {
682
+ blogElement.isotope({
683
+ itemSelector: ".premium-blog-post-container",
684
+ percentPosition: true,
685
+ animationOptions: {
686
+ duration: 750,
687
+ easing: "linear",
688
+ queue: false
689
+ }
690
+ });
691
+ });
692
+ }
693
+
694
+ if (carousel && !masonryBlog) {
695
+ $(blogElement).slick({
696
+ infinite: true,
697
+ slidesToShow: colsNumber,
698
+ slidesToScroll: colsNumber,
699
+ responsive: [
700
+ {
701
+ breakpoint: 769,
702
+ settings: {
703
+ slidesToShow: 1,
704
+ slidesToScroll: 1
705
+ }
706
+ },
707
+ {
708
+ breakpoint: 481,
709
+ settings: {
710
+ slidesToShow: 1,
711
+ slidesToScroll: 1
712
+ }
713
+ }
714
+ ],
715
+ autoplay: autoPlay,
716
+ autoplaySpeed: speed,
717
+ nextArrow: nextArrow,
718
+ prevArrow: prevArrow,
719
+ fade: fade,
720
+ draggable: true
721
+ });
722
+ }
723
+ };
724
+
725
+ /****** Premium Image Scroll ******/
726
+ var PremiumImageScrollHandler = function ($scope, $) {
727
+ var scrollElement = $scope.find(".premium-image-scroll-container"),
728
+ scrollOverlay = scrollElement.find(".premium-image-scroll-overlay"),
729
+ scrollVertical = scrollElement.find(
730
+ ".premium-image-scroll-vertical"
731
+ ),
732
+ dataElement = scrollElement.data("settings"),
733
+ imageScroll = scrollElement.find(".premium-image-scroll-image"),
734
+ direction = dataElement["direction"],
735
+ reverse = dataElement["reverse"],
736
+ transformOffset = null;
737
+
738
function startTransform() {
739
+ imageScroll.css(
740
+ "transform",
741
+ (direction === "vertical" ? "translateY" : "translateX") +
742
+ "( -" +
743
+ transformOffset +
744
+ "px)"
745
+ );
746
}
747
+
748
function endTransform() {
749
+ imageScroll.css(
750
+ "transform",
751
+ (direction === "vertical" ? "translateY" : "translateX") +
752
+ "(0px)"
753
+ );
754
}
755
+
756
function setTransform() {
757
+ if (direction === "vertical") {
758
transformOffset = imageScroll.height() - scrollElement.height();
759
} else {
760
transformOffset = imageScroll.width() - scrollElement.width();
761
}
762
}
763
+
764
+ if (dataElement["trigger"] === "scroll") {
765
scrollElement.addClass("premium-container-scroll");
766
+ if (direction === "vertical") {
767
scrollVertical.addClass("premium-image-scroll-ver");
768
} else {
769
+ scrollElement.imagesLoaded(function () {
770
+ scrollOverlay.css({
771
+ width: imageScroll.width(),
772
+ height: imageScroll.height()
773
+ });
774
});
775
}
776
} else {
777
+ if (reverse === "yes") {
778
+ scrollElement.imagesLoaded(function () {
779
scrollElement.addClass("premium-container-scroll-instant");
780
setTransform();
781
startTransform();
782
});
783
}
784
+ if (direction === "vertical") {
785
scrollVertical.removeClass("premium-image-scroll-ver");
786
}
787
+ scrollElement.mouseenter(function () {
788
scrollElement.removeClass("premium-container-scroll-instant");
789
setTransform();
790
+ reverse === "yes" ? endTransform() : startTransform();
791
});
792
793
+ scrollElement.mouseleave(function () {
794
+ reverse === "yes" ? startTransform() : endTransform();
795
});
796
}
797
};
798
799
+ //Elementor JS Hooks
800
+ $(window).on("elementor/frontend/init", function () {
801
+ elementorFrontend.hooks.addAction(
802
+ "frontend/element_ready/premium-addon-video-box.default",
803
+ PremiumVideoBoxWidgetHandler
804
+ );
805
+ elementorFrontend.hooks.addAction(
806
+ "frontend/element_ready/premium-img-gallery.default",
807
+ PremiumGridWidgetHandler
808
+ );
809
+ elementorFrontend.hooks.addAction(
810
+ "frontend/element_ready/premium-addon-fancy-text.default",
811
+ PremiumFancyTextHandler
812
+ );
813
+ elementorFrontend.hooks.addAction(
814
+ "frontend/element_ready/premium-counter.default",
815
+ PremiumCounterHandler
816
+ );
817
+ elementorFrontend.hooks.addAction(
818
+ "frontend/element_ready/premium-countdown-timer.default",
819
+ PremiumCountDownHandler
820
+ );
821
+ elementorFrontend.hooks.addAction(
822
+ "frontend/element_ready/premium-carousel-widget.default",
823
+ PremiumCarouselHandler
824
+ );
825
+ elementorFrontend.hooks.addAction(
826
+ "frontend/element_ready/premium-addon-banner.default",
827
+ PremiumBannerHandler
828
+ );
829
+ elementorFrontend.hooks.addAction(
830
+ "frontend/element_ready/premium-addon-modal-box.default",
831
+ PremiumModalBoxHandler
832
+ );
833
+ elementorFrontend.hooks.addAction(
834
+ "frontend/element_ready/premium-addon-blog.default",
835
+ PremiumBlogHandler
836
+ );
837
+ elementorFrontend.hooks.addAction(
838
+ "frontend/element_ready/premium-image-scroll.default",
839
+ PremiumImageScrollHandler
840
+ );
841
+ if (elementorFrontend.isEditMode()) {
842
+ elementorFrontend.hooks.addAction(
843
+ "frontend/element_ready/premium-addon-progressbar.default",
844
+ PremiumProgressBarWidgetHandler
845
+ );
846
+ } else {
847
+ elementorFrontend.hooks.addAction(
848
+ "frontend/element_ready/premium-addon-progressbar.default",
849
+ PremiumProgressBarScrollWidgetHandler
850
+ );
851
+ }
852
+ });
853
+ })(jQuery);
assets/frontend/js/premium-vscroll.js CHANGED
@@ -1,760 +1,769 @@
1
// Works on mobile but needs enhancements
2
3
- ( function( $ ) {
4
-
5
- /****** Premium Vertical Scroll Handler ******/
6
- var PremiumVerticalScrollHandler = function($scope, $) {
7
-
8
- var vScrollElem = $scope.find( ".premium-vscroll-wrap" ),
9
- instance = null,
10
- vScrollSettings = vScrollElem.data( "settings" );
11
-
12
- // var touch = vScrollSettings.touch;
13
-
14
- instance = new premiumVerticalScroll( vScrollElem, vScrollSettings );
15
instance.init();
16
17
- // var isTouchDevice = navigator.userAgent.match(/(iPhone|iPod|iPad|Android|playbook|silk|BlackBerry|BB10|Windows Phone|Tizen|Bada|webOS|IEMobile|Opera Mini)/);
18
- // var isTouch = (('ontouchstart' in window) || (navigator.msMaxTouchPoints > 0) || (navigator.maxTouchPoints));
19
- //
20
- //
21
- // if( touch ) {
22
- // instance = new premiumVerticalScroll2( vScrollElem, vScrollSettings );
23
- // instance.init();
24
- // } else {
25
- // if ( isTouchDevice || isTouch ) {
26
- // instance = new premiumVerticalScroll( vScrollElem, vScrollSettings );
27
- // instance.init();
28
- // } else {
29
- // instance = new premiumVerticalScroll2( vScrollElem, vScrollSettings );
30
- // instance.init();
31
- // }
32
- // }
33
-
34
35
- };
36
-
37
-
38
- window.premiumVerticalScroll2 = function( $selector, settings ) {
39
-
40
- var self = this,
41
- $instance = $selector,
42
- $window = $( window ),
43
- $htmlBody = $("html, body"),
44
- checkTemps = $selector.find( ".premium-vscroll-sections-wrap" ).length,
45
- deviceType = $("body").data("elementor-device-mode"),
46
- $itemsList = $(".premium-vscroll-dot-item", $instance),
47
- $menuItems = $(".premium-vscroll-nav-item", $instance),
48
- animated = 0;
49
-
50
-
51
- var $lastItem = $itemsList.last(),
52
- lastSectionId = $lastItem.data("menuanchor"),
53
- lastOffset = Math.round( $( "#" + lastSectionId ).offset().top );
54
-
55
- self.init = function() {
56
-
57
- self.setSectionsData();
58
-
59
- $itemsList.on("click.premiumVerticalScroll", self.onNavDotChange);
60
- $menuItems.on("click.premiumVerticalScroll", self.onNavDotChange);
61
62
- $itemsList.on( "mouseenter.premiumVerticalScroll", self.onNavDotEnter );
63
64
- $itemsList.on( "mouseleave.premiumVerticalScroll", self.onNavDotLeave );
65
-
66
- $.scrollify({
67
- section: ".premium-vscroll-section",
68
- updateHash: false,
69
- standardScrollElements: "#" + lastSectionId,
70
- scrollSpeed: settings.speed,
71
- overflowScroll: settings.overflow,
72
- setHeights: settings.setHeight,
73
- before: function( index ) {
74
-
75
- $menuItems.removeClass("active");
76
- $itemsList.removeClass("active");
77
78
- $( $itemsList[ index ] ).addClass( "active" );
79
- $( $menuItems[ index ] ).addClass( "active" );
80
-
81
- },
82
- after: function( index ) {
83
-
84
- if ( index === $lastItem.index() ) {
85
- // $.scrollify.disable();
86
}
87
-
88
- },
89
- afterRender: function() {
90
-
91
- $( $itemsList[ 0 ] ).addClass( "active" );
92
- $( $menuItems[ 0 ] ).addClass( "active" );
93
-
94
}
95
- });
96
-
97
- if ( deviceType === "desktop" ) {
98
-
99
- $window.on( "scroll.premiumVerticalScroll2", self.onWheel );
100
-
101
- }
102
-
103
- if ( settings.fullSection ) {
104
-
105
- var vSection = document.getElementById( $instance.attr("id") );
106
-
107
- if ( checkTemps ) {
108
-
109
- document.addEventListener
110
- ? vSection.addEventListener("wheel", self.onWheel, !1)
111
- : vSection.attachEvent("onmousewheel", self.onWheel);
112
-
113
} else {
114
-
115
- document.addEventListener
116
- ? document.addEventListener("wheel", self.onWheel, !1)
117
- : document.attachEvent("onmousewheel", self.onWheel);
118
-
119
}
120
- }
121
-
122
- };
123
-
124
- self.onWheel = function( event ) {
125
-
126
- var $target = $( event.target ),
127
- sectionSelector = checkTemps ? ".premium-vscroll-temp" : ".elementor-top-section",
128
- $section = $target.closest( sectionSelector ),
129
- sectionId = $section.attr( "id" ),
130
- $currentSection = $.scrollify.current();
131
-
132
- //re-enable Scrollify
133
- if ( sectionId !== lastSectionId && $section.hasClass("premium-vscroll-section") && $.scrollify.isDisabled() ) {
134
-
135
- $(".premium-vscroll-dots, .premium-vscroll-nav-menu").removeClass(
136
- "premium-vscroll-dots-hide"
137
- );
138
-
139
- $.scrollify.enable();
140
-
141
- }
142
-
143
- if ( ! $section.hasClass("premium-vscroll-section") && $.scrollify.isDisabled() ) {
144
-
145
- $(".premium-vscroll-tooltip").hide();
146
-
147
- $(".premium-vscroll-dots, .premium-vscroll-nav-menu").addClass(
148
- "premium-vscroll-dots-hide"
149
- );
150
-
151
- }
152
-
153
-
154
-
155
- };
156
-
157
- self.moveSectionDown = function() {
158
- $.scrollify.next();
159
- }
160
-
161
- self.moveSectionUp = function() {
162
- $.scrollify.previous();
163
- }
164
-
165
- self.moveToSection = function( index ) {
166
-
167
- $.scrollify.move( index );
168
- }
169
-
170
- self.setSectionsData = function() {
171
-
172
- $itemsList.each( function() {
173
-
174
- var $this = $( this ),
175
- sectionId = $this.data( "menuanchor" ),
176
- $section = $( "#" + sectionId );
177
-
178
- $section.addClass( "premium-vscroll-section" );
179
-
180
- });
181
-
182
- };
183
-
184
- self.onNavDotChange = function( event ) {
185
-
186
- var $this = $( this ),
187
- index = $this.index(),
188
- sectionId = $this.data("menuanchor");
189
190
- // if ( ! isScrolling ) {
191
-
192
- if ( $.scrollify.isDisabled() ) {
193
-
194
- $.scrollify.enable();
195
-
196
- }
197
198
- $menuItems.removeClass("active");
199
- $itemsList.removeClass("active");
200
201
- if ( $this.hasClass( "premium-vscroll-nav-item") ) {
202
-
203
- $( $itemsList[ index ] ).addClass( "active" );
204
-
205
- } else {
206
-
207
- $( $menuItems[ index ] ).addClass( "active" );
208
- }
209
210
- $this.addClass( "active" );
211
-
212
- self.moveToSection( index );
213
-
214
- // }
215
- };
216
-
217
- self.onNavDotEnter = function() {
218
-
219
- var $this = $( this ),
220
- index = $this.data("index");
221
-
222
- if ( settings.tooltips ) {
223
-
224
- $('<div class="premium-vscroll-tooltip"><span>' + settings.dotsText[index] + "</span></div>" ).hide().appendTo( $this ).fadeIn( 200 );
225
- }
226
-
227
- };
228
229
- self.onNavDotLeave = function() {
230
-
231
- $( ".premium-vscroll-tooltip" ).fadeOut( 200, function() {
232
-
233
- $( this ).remove();
234
-
235
- });
236
-
237
};
238
239
-
240
-
241
- };
242
-
243
- window.premiumVerticalScroll = function($selector, settings) {
244
- var self = this,
245
- $window = $(window),
246
- $instance = $selector,
247
- checkTemps = $selector.find(".premium-vscroll-sections-wrap").length,
248
- $htmlBody = $("html, body"),
249
- deviceType = $("body").data("elementor-device-mode"),
250
- $itemsList = $(".premium-vscroll-dot-item", $instance),
251
- $menuItems = $(".premium-vscroll-nav-item", $instance),
252
- defaultSettings = {
253
- speed: 700,
254
- offset: 1,
255
- fullSection: true
256
- },
257
- settings = $.extend({}, defaultSettings, settings),
258
- sections = {},
259
- timeStamp = 0,
260
- currentSection = null,
261
- platform = navigator.platform,
262
- isScrolling = false;
263
-
264
- jQuery.extend(jQuery.easing, {
265
- easeInOutCirc: function(x, t, b, c, d) {
266
- if ((t /= d / 2) < 1) return (-c / 2) * (Math.sqrt(1 - t * t) - 1) + b;
267
- return (c / 2) * (Math.sqrt(1 - (t -= 2) * t) + 1) + b;
268
- }
269
- });
270
271
- self.checkNextSection = function(object, key) {
272
- var keys = Object.keys(object),
273
- idIndex = keys.indexOf(key),
274
- nextIndex = (idIndex += 1);
275
276
- if (nextIndex >= keys.length) {
277
- return false;
278
- }
279
280
- var nextKey = keys[nextIndex];
281
282
- return nextKey;
283
- };
284
285
- self.checkPrevSection = function(object, key) {
286
- var keys = Object.keys(object),
287
- idIndex = keys.indexOf(key),
288
- prevIndex = (idIndex -= 1);
289
290
- if (0 > idIndex) {
291
- return false;
292
- }
293
294
- var prevKey = keys[prevIndex];
295
296
- return prevKey;
297
- };
298
299
- self.debounce = function(threshold, callback) {
300
- var timeout;
301
302
- return function debounced($event) {
303
- function delayed() {
304
- callback.call(this, $event);
305
- timeout = null;
306
- }
307
308
- if (timeout) {
309
- clearTimeout(timeout);
310
- }
311
312
- timeout = setTimeout(delayed, threshold);
313
- };
314
- };
315
- self.visible = function(selector, partial, hidden){
316
-
317
- var s = selector.get(0),
318
- vpHeight = $window.outerHeight(),
319
- clientSize = hidden === true ? s.offsetWidth * s.offsetHeight : true;
320
- if (typeof s.getBoundingClientRect === 'function') {
321
- var rec = s.getBoundingClientRect();
322
- var tViz = rec.top >= 0 && rec.top < vpHeight,
323
- bViz = rec.bottom > 0 && rec.bottom <= vpHeight,
324
- vVisible = partial ? tViz || bViz : tViz && bViz,
325
- vVisible = (rec.top < 0 && rec.bottom > vpHeight) ? true : vVisible;
326
- return clientSize && vVisible;
327
- } else {
328
- var viewTop = 0,
329
- viewBottom = viewTop + vpHeight,
330
- position = $window.position(),
331
- _top = position.top,
332
- _bottom = _top + $window.height(),
333
- compareTop = partial === true ? _bottom : _top,
334
- compareBottom = partial === true ? _top : _bottom;
335
- return !!clientSize && ((compareBottom <= viewBottom) && (compareTop >= viewTop));
336
- }
337
-
338
- };
339
340
- self.init = function() {
341
-
342
- self.setSectionsData();
343
-
344
- $itemsList.on("click.premiumVerticalScroll", self.onNavDotChange);
345
- $menuItems.on("click.premiumVerticalScroll", self.onNavDotChange);
346
-
347
- $itemsList.on("mouseenter.premiumVerticalScroll", self.onNavDotEnter);
348
-
349
- $itemsList.on("mouseleave.premiumVerticalScroll", self.onNavDotLeave);
350
-
351
- if (deviceType === "desktop") {
352
- $window.on("scroll.premiumVerticalScroll", self.onWheel);
353
- }
354
-
355
- $window.on(
356
- "resize.premiumVerticalScroll orientationchange.premiumVerticalScroll",
357
- self.debounce(50, self.onResize)
358
- );
359
- $window.on("load", function() {
360
- self.setSectionsData();
361
- });
362
-
363
- self.keyboardHandler();
364
-
365
- self.scrollHandler();
366
-
367
- for (var section in sections) {
368
- var $section = sections[section].selector;
369
- elementorFrontend.waypoint(
370
- $section,
371
- function(direction) {
372
- var $this = $(this),
373
- sectionId = $this.attr("id");
374
- if ("down" === direction && !isScrolling) {
375
- currentSection = sectionId;
376
- $itemsList.removeClass("active");
377
- $menuItems.removeClass("active");
378
- $("[data-menuanchor=" + sectionId + "]", $instance).addClass(
379
- "active"
380
- );
381
}
382
- },
383
- {
384
- offset: "95%",
385
- triggerOnce: false
386
- }
387
- );
388
389
- elementorFrontend.waypoint(
390
- $section,
391
- function(direction) {
392
- var $this = $(this),
393
- sectionId = $this.attr("id");
394
- if ("up" === direction && !isScrolling) {
395
- currentSection = sectionId;
396
- $itemsList.removeClass("active");
397
- $menuItems.removeClass("active");
398
- $("[data-menuanchor=" + sectionId + "]", $instance).addClass(
399
- "active"
400
- );
401
}
402
- },
403
- {
404
- offset: "0%",
405
- triggerOnce: false
406
- }
407
- );
408
- }
409
- };
410
-
411
- self.keyboardHandler = function() {
412
-
413
- $(document).keydown(function(event) {
414
- if (38 == event.keyCode) {
415
- self.onKeyUp(event, "up");
416
}
417
418
- if (40 == event.keyCode) {
419
- self.onKeyUp(event, "down");
420
}
421
- });
422
-
423
- };
424
-
425
- self.scrollHandler = function() {
426
-
427
- if (settings.fullSection) {
428
- var vSection = document.getElementById($instance.attr("id"));
429
430
- if (checkTemps) {
431
- document.addEventListener
432
- ? vSection.addEventListener("wheel", self.onWheel,{ passive: false })
433
- : vSection.attachEvent("onmousewheel", self.onWheel);
434
- } else {
435
- document.addEventListener
436
- ? document.addEventListener("wheel", self.onWheel,{ passive: false })
437
- : document.attachEvent("onmousewheel", self.onWheel);
438
}
439
- }
440
-
441
- };
442
443
- self.setSectionsData = function() {
444
- $itemsList.each(function() {
445
- var $this = $(this),
446
- sectionId = $this.data("menuanchor"),
447
- $section = $("#" + sectionId);
448
- if ($section[0]) {
449
- sections[sectionId] = {
450
- selector: $section,
451
- offset: Math.round($section.offset().top),
452
- height: $section.outerHeight()
453
- };
454
- }
455
- });
456
- };
457
458
- self.onNavDotEnter = function() {
459
- var $this = $(this),
460
- index = $this.data("index");
461
- if (settings.tooltips) {
462
- $(
463
- '<div class="premium-vscroll-tooltip"><span>' +
464
- settings.dotsText[index] +
465
- "</span></div>"
466
- )
467
- .hide()
468
- .appendTo($this)
469
- .fadeIn(200);
470
- }
471
- };
472
473
- self.onNavDotLeave = function() {
474
- $(".premium-vscroll-tooltip").fadeOut(200, function() {
475
- $(this).remove();
476
- });
477
- };
478
479
- self.onNavDotChange = function(event) {
480
- var $this = $(this),
481
- index = $this.index(),
482
- sectionId = $this.data("menuanchor"),
483
- offset = null;
484
485
- if (!sections.hasOwnProperty(sectionId)) {
486
- return false;
487
- }
488
489
- offset = sections[sectionId].offset - settings.offset;
490
491
- if (!isScrolling) {
492
- isScrolling = true;
493
494
- currentSection = sectionId;
495
- $menuItems.removeClass("active");
496
- $itemsList.removeClass("active");
497
498
- if ($this.hasClass("premium-vscroll-nav-item")) {
499
- $($itemsList[index]).addClass("active");
500
- } else {
501
- $($menuItems[index]).addClass("active");
502
- }
503
504
- $this.addClass("active");
505
-
506
- $htmlBody
507
- .stop()
508
- .clearQueue()
509
- .animate(
510
- { scrollTop: offset },
511
- settings.speed,
512
- "easeInOutCirc",
513
- function() {
514
- isScrolling = false;
515
}
516
- );
517
- }
518
- };
519
520
- self.onAnchorChange = function( sectionId ) {
521
-
522
- var $this = $("[data-menuanchor=" + sectionId + "]", $instance),
523
- offset = null;
524
525
- if ( ! sections.hasOwnProperty( sectionId ) ) {
526
- return false;
527
- }
528
529
- offset = sections[sectionId].offset - settings.offset;
530
531
- if ( ! isScrolling ) {
532
- isScrolling = true;
533
534
- window.history.pushState(null, null, "#" + sectionId);
535
- currentSection = sectionId;
536
537
- $itemsList.removeClass("active");
538
- $menuItems.removeClass("active");
539
540
- $this.addClass( "active" );
541
542
- $htmlBody.animate(
543
- { scrollTop: offset },
544
- settings.speed,
545
- "easeInOutCirc",
546
- function() {
547
- isScrolling = false;
548
- }
549
- );
550
- }
551
-
552
- };
553
554
- self.onKeyUp = function(event, direction) {
555
- var direction = direction || "up",
556
- sectionId,
557
- nextItem = $(
558
- ".premium-vscroll-dot-item[data-menuanchor=" + currentSection + "]",
559
- $instance
560
- ).next(),
561
- prevItem = $(
562
- ".premium-vscroll-dot-item[data-menuanchor=" + currentSection + "]",
563
- $instance
564
- ).prev();
565
-
566
- event.preventDefault();
567
-
568
- if (isScrolling) {
569
- return false;
570
- }
571
-
572
- if ("up" === direction) {
573
- if (prevItem[0]) {
574
- prevItem.trigger("click.premiumVerticalScroll");
575
}
576
- }
577
578
- if ("down" === direction) {
579
- if (nextItem[0]) {
580
- nextItem.trigger("click.premiumVerticalScroll");
581
}
582
- }
583
- };
584
585
- self.onScroll = function(event) {
586
- /* On Scroll Event */
587
- if (isScrolling) {
588
- event.preventDefault();
589
- }
590
- };
591
-
592
- function getFirstSection(object) {
593
- return Object.keys(object)[0];
594
- }
595
-
596
- function getLastSection(object) {
597
- return Object.keys(object)[Object.keys(object).length - 1];
598
- }
599
-
600
- function getDirection(e) {
601
- e = window.event || e;
602
- var t = Math.max(-1, Math.min(1, e.wheelDelta || -e.deltaY || -e.detail));
603
- return t;
604
- }
605
-
606
- self.onWheel = function(event) {
607
- if (isScrolling) {
608
- event.preventDefault();
609
- return false;
610
- }
611
-
612
- var $target = $(event.target),
613
- sectionSelector = checkTemps
614
- ? ".premium-vscroll-temp"
615
- : ".elementor-top-section",
616
- $section = $target.closest(sectionSelector),
617
- $vTarget = self.visible($instance, true, false),
618
- sectionId = $section.attr("id"),
619
- offset = 0,
620
- newSectionId = false,
621
- prevSectionId = false,
622
- nextSectionId = false,
623
- delta = getDirection(event),
624
- direction = 0 > delta ? "down" : "up",
625
- windowScrollTop = $window.scrollTop(),
626
- dotIndex = $(".premium-vscroll-dot-item.active").index();
627
- if ("mobile" === deviceType || "tablet" === deviceType) {
628
- $(".premium-vscroll-tooltip").hide();
629
- if (dotIndex === $itemsList.length - 1 && !$vTarget) {
630
- $(".premium-vscroll-dots, .premium-vscroll-nav-menu").addClass(
631
- "premium-vscroll-dots-hide"
632
- );
633
- } else if (dotIndex === 0 && !$vTarget) {
634
- if ($instance.offset().top - $(document).scrollTop() > 200) {
635
- $(".premium-vscroll-dots, .premium-vscroll-nav-menu").addClass(
636
- "premium-vscroll-dots-hide"
637
);
638
- }
639
- } else {
640
- $(".premium-vscroll-dots, .premium-vscroll-nav-menu").removeClass(
641
- "premium-vscroll-dots-hide"
642
- );
643
- }
644
- }
645
-
646
- if (beforeCheck()) {
647
- sectionId = getFirstSection(sections);
648
- }
649
-
650
- if (afterCheck()) {
651
- sectionId = getLastSection(sections);
652
- }
653
- if (sectionId && sections.hasOwnProperty(sectionId)) {
654
- prevSectionId = self.checkPrevSection(sections, sectionId);
655
- nextSectionId = self.checkNextSection(sections, sectionId);
656
- if ("up" === direction) {
657
- if (!nextSectionId && sections[sectionId].offset < windowScrollTop) {
658
- newSectionId = sectionId;
659
- } else {
660
- newSectionId = prevSectionId;
661
- }
662
}
663
664
- if ("down" === direction) {
665
- if (
666
- !prevSectionId &&
667
- sections[sectionId].offset > windowScrollTop + 5
668
- ) {
669
- newSectionId = sectionId;
670
- } else {
671
- newSectionId = nextSectionId;
672
- }
673
- }
674
675
- if (newSectionId) {
676
- $(".premium-vscroll-dots, .premium-vscroll-nav-menu").removeClass(
677
- "premium-vscroll-dots-hide"
678
- );
679
- event.preventDefault();
680
-
681
- if (event.timeStamp - timeStamp > 10 && "MacIntel" == platform) {
682
- timeStamp = event.timeStamp;
683
684
- return false;
685
- }
686
687
- self.onAnchorChange(newSectionId);
688
-
689
- } else {
690
- var $lastselector = checkTemps ? $instance : $("#" + sectionId);
691
- if ("down" === direction) {
692
- if (
693
- $lastselector.offset().top +
694
- $lastselector.innerHeight() -
695
- $(document).scrollTop() >
696
- 600
697
- ) {
698
- $(".premium-vscroll-dots, .premium-vscroll-nav-menu").addClass(
699
- "premium-vscroll-dots-hide"
700
- );
701
}
702
- } else if ("up" === direction) {
703
- if ($lastselector.offset().top - $(document).scrollTop() > 200) {
704
- $(".premium-vscroll-dots, .premium-vscroll-nav-menu").addClass(
705
- "premium-vscroll-dots-hide"
706
- );
707
}
708
- }
709
}
710
- }
711
- };
712
713
- function beforeCheck(event) {
714
- var windowScrollTop = $window.scrollTop(),
715
- firstSectionId = getFirstSection(sections),
716