✏️ 正在编辑: slider.js
路径:
/home/h359620/public_html/wp-content/themes/datis/inc/elementor/widgets/datis_slider/js/slider.js
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
(function ($) { 'use strict'; function initDatisSlider($slider) { var $dots = $slider.find('.datis-slider-dot'); var $slides = $slider.find('.datis-slider-slide'); var $prev = $slider.find('.datis-slider-arrow-prev'); var $next = $slider.find('.datis-slider-arrow-next'); if (!$slides.length) { return; } var current = 0; function goTo(index) { var total = $slides.length; if (index < 0) { index = total - 1; } if (index >= total) { index = 0; } current = index; $slides.removeClass('is-active'); $dots.removeClass('is-active'); $slides.eq(current).addClass('is-active'); $dots.eq(current).addClass('is-active'); } $dots.on('click', function (e) { e.preventDefault(); var index = parseInt($(this).attr('data-slide'), 10); if (isNaN(index)) { index = 0; } goTo(index); }); $prev.on('click', function (e) { e.preventDefault(); goTo(current - 1); }); $next.on('click', function (e) { e.preventDefault(); goTo(current + 1); }); } // اجرای اسلایدر در فرانت و ادیتور $(window).on('elementor/frontend/init', function () { var widgetHandler = function ($scope) { var $slider = $scope.find('.datis-slider'); if ($slider.length) { $slider.each(function () { initDatisSlider($(this)); }); } }; elementorFrontend.hooks.addAction( 'frontend/element_ready/datis_slider.default', widgetHandler ); }); })(jQuery);
💾 保存文件
← 返回文件管理器