解決Elementor lightbox 會同時輪播兩個以上的Carousel圖片集

1.Elementor > Custom Code

2.新增,位置選擇【End】

3.貼上以下程式碼

<script>
jQuery(document).ready(function ($) {
  
	//Limit carousel lightboxes to opening only the images within the carousel (instead of all the carousels on the page)
	
	// set incrementing counter:
	var i = 0;
	// loop through the galleries:
	$('.elementor-image-carousel-wrapper').each(function () {

		// get the current id of the lightbox gallery link
		var oldAttrLightbox = $(this).find('a').attr('data-elementor-lightbox-slideshow');

		// add the incrementing number to it:
		var newAttrLightbox = oldAttrLightbox + i;

		// replace the old gallery link attr with the new one generated above
		$(this).find('a').attr('data-elementor-lightbox-slideshow', newAttrLightbox);

		// increment the counter
		i = i + 1;

	})
	
});
</script>

發佈留言