jQuery(document).ready(function($) {
	$('.ha-post-swiper').each(function() {
		var $this = $(this);
        
		var autoSpeed = parseInt($this.data('speed')) || 3000;
		var transitionDelay = parseInt($this.data('delay')) || 500;
		// 表示枚数を取得（設定がなければデフォルト値を使用）
		var slides768 = parseInt($this.data('slides-768')) || 2;
		var slides1024 = parseInt($this.data('slides-1024')) || 3;
		var slides1200 = parseInt($this.data('slides-1200')) || 6;
		var slides1900 = parseInt($this.data('slides-1900')) || 8;

		var swiper = new Swiper(this, {
			speed: transitionDelay,
			slidesPerView: 1,
			spaceBetween: 20,
			loop: true,
			autoplay: {
				delay: autoSpeed,
				disableOnInteraction: false,
				pauseOnMouseEnter: true,
			},
			navigation: {
				nextEl: $this.find('.swiper-button-next')[0],
				prevEl: $this.find('.swiper-button-prev')[0],
			},
			breakpoints: {
				768: { slidesPerView: 2 },
				1024: { slidesPerView: 3 },
				1200: { slidesPerView: slides1200 }, // 変数を適用
				1900: { slidesPerView: slides1900 }  // 変数を適用
			}
		});
	});
});