/*
Author : hyojeong yang
Date : 2025-09-22
Project : 온세종
*/
if (jQuery) (function ($) {
$.extend($.fn, {
mnVisualSwiper: function (obj) {
return this.each(function () {
var $container = $(this);
var $el = $container.find('.swiper');
var $btnPrev = $container.find('.swiper-button-prev')[0];
var $btnNext = $container.find('.swiper-button-next')[0];
var $btnsPagination = $container.find('.swiper-pagination')[0];
var $btnPlayStop = $container.find('.swiper-btn-playstop-toggle')[0];
var isPaused = false; // 재생 상태 변수 (컨테이너별)
var swiper = new Swiper($el[0], {
preloadImages: true,
autoplay: {
delay: 3000,
disableOnInteraction: false,
},
loop: true,
speed: 1500,
slidesPerView: 1,
initialSlide: 0,
watchSlidesProgress: true,
navigation: {
prevEl: $btnPrev,
nextEl: $btnNext
},
pagination: {
el: $btnsPagination,
type: "custom",
renderCustom: function (swiper, current, total) {
return `
${current}
${total}
`;
},
},
});
// 재생/중지 버튼
$($btnPlayStop).on('click', function () {
if (isPaused) {
swiper.autoplay.start();
$(this).removeClass('is-stop').text('중지');
isPaused = false;
} else {
swiper.autoplay.stop();
$(this).addClass('is-stop').text('재생');
isPaused = true;
}
});
});
},
mnCourseSwiper: function (obj) {
return this.each(function () {
var $container = $(this);
var $el = $container.find('.swiper');
var $btnPrev = $container.find('.swiper-button-prev')[0];
var $btnNext = $container.find('.swiper-button-next')[0];
var swiper = new Swiper($el[0], {
preloadImages: true,
loop: true,
// effect: "fade",
// fadeEffect: {
// crossFade: true,
// },
speed: 1000,
spaceBetween: 16,
slidesPerView: 1.1,
initialSlide: 0,
watchSlidesProgress: true,
navigation: {
prevEl: $btnPrev,
nextEl: $btnNext
},
breakpoints: {
768: {
slidesPerView: 2.2,
spaceBetween: 24,
},
1280: {
slidesPerView: 3,
spaceBetween: 40,
},
},
});
});
}
});
})(jQuery);
$(document).ready(function () {
$('.mn-visual').mnVisualSwiper();
$('.mn-course .mn-cont').mnCourseSwiper();
});