我尝试动态更改自定义Elementor小部件的swiper slide的自动播放参数。我尝试在swiper类中动态传递字符串作为对象。但它不起作用。
(function($){
"use strict";
var WidgetTestimonialCarouselHandler = function ($scope, $) {
var carousel_elem = $scope.find('.tpc-testimonial-wrapper-ff').eq(0);
var settings = carousel_elem.data('settings');
var autoPlay = settings['autoplay'];
var autoplay_speed = parseInt(settings['autoplay_speed']) || 3000;
var infiniteLoop = settings['infinite_loop'];
var display_columns = parseInt(settings['display_columns']) || 2;
var item_gap = parseInt(settings['item_gap']) || 20;
var auto_Play = autoPlay;
if (autoPlay==true){
auto_Play = 'autoplay:{delay: '+autoplay_speed+'},'
}
else{
auto_Play = 'autoplay:false,'
};
var wc_auto_play = auto_Play.replace(/"/g, '');
var swiper = new Swiper('.tpc-testimonial-ff', {
spaceBetween: item_gap,
slidesPerView: display_columns,
loop: infiniteLoop,
wc_auto_play,
});
}
$(window).on('elementor/frontend/init', function () {
elementorFrontend.hooks.addAction( 'frontend/element_ready/eduhut-testi-addons.default', WidgetTestimonialCarouselHandler);
});
})(jQuery);
字符串
我想使用elementor的切换按钮关闭或打开自动播放,我还需要更改自动播放的延迟值。但是当我将该参数作为sting传递而不使用qoute时,它不起作用。
1条答案
按热度按时间r1zhe5dt1#
字符串