| 1 |
(function ($, elementor) { |
| 2 |
|
| 3 |
'use strict'; |
| 4 |
|
| 5 |
var widgetImageHotspot = function ($scope, $) { |
| 6 |
|
| 7 |
var $imageHotspot = $scope.find('.usk-image-hotspot'), |
| 8 |
$settings = $imageHotspot.data('settings'); |
| 9 |
|
| 10 |
if (!$imageHotspot.length) { |
| 11 |
return; |
| 12 |
} |
| 13 |
|
| 14 |
if ($settings.image_hotspot_layout === 'slider') { |
| 15 |
|
| 16 |
var $thumbs = $imageHotspot.find('.usk-image-hotspot-thumbs'); |
| 17 |
|
| 18 |
const Swiper = elementorFrontend.utils.swiper; |
| 19 |
initSwiper(); |
| 20 |
async function initSwiper() { |
| 21 |
|
| 22 |
var sliderThumbs = await new Swiper($thumbs, $settings); |
| 23 |
|
| 24 |
var $imageHotspotContainer = $imageHotspot.find('.usk-image-hotspot-main'); |
| 25 |
|
| 26 |
var mainSlider = await new Swiper($imageHotspotContainer, { |
| 27 |
slidesPerView: 1, |
| 28 |
effect: $settings.sliderEffect, |
| 29 |
fadeEffect: { |
| 30 |
crossFade: true |
| 31 |
}, |
| 32 |
thumbs: { |
| 33 |
swiper: sliderThumbs, |
| 34 |
}, |
| 35 |
}); |
| 36 |
|
| 37 |
}; |
| 38 |
|
| 39 |
} |
| 40 |
|
| 41 |
var $tooltip = $imageHotspot.find('.bdt-tippy-tooltip'); |
| 42 |
|
| 43 |
$tooltip.each( function( index ) { |
| 44 |
tippy( this, { |
| 45 |
allowHTML: true, |
| 46 |
interactive: true, |
| 47 |
theme: 'bdt-tippy-' + $settings.id, |
| 48 |
appendTo: document.body, |
| 49 |
}); |
| 50 |
}); |
| 51 |
|
| 52 |
}; |
| 53 |
|
| 54 |
jQuery(window).on('elementor/frontend/init', function () { |
| 55 |
elementorFrontend.hooks.addAction('frontend/element_ready/usk-image-hotspot.default', widgetImageHotspot); |
| 56 |
}); |
| 57 |
|
| 58 |
}(jQuery, window.elementorFrontend)); |