Support » Plugin: Shortcodes Ultimate » Carousel su little hack

  • Resolved dpared

    (@dpared)



    Hi folks,
    I found a problem on the su carousel, when I use the lightbox option for a category carousel.
    The lightbox use all divs (even the .swiper-slide-duplicate divs). Then for 17 items for a category, you have 29 items on the lightbox.
    I wrote a little hack for the plugins/shortcodes-ultimate/assets/js/galleries-shortcodes.js file

    $('.su-lightbox-gallery').each(function () {
    		console.log ("hack");
    		//find good delegate
    		var delegateHack=$(this).find('div').find('.su-carousel-slide').not(".swiper-slide-duplicate").find("a");
    		console.log(delegateHack);
    
    		delegateHack.magnificPopup({			
    
    			type: 'image',
    			mainClass: 'mfp-img-mobile',
    			gallery: {
    				enabled: true,
    				navigateByImgClick: true,
    				preload: [0, 1], // Will preload 0 - before current, and 1 after the current image
    				tPrev: su_magnific_popup.prev,
    				tNext: su_magnific_popup.next,
    				tCounter: su_magnific_popup.counter
    			},
    			image: {
    				tError: su_magnific_popup.error,
    				titleSrc: function (item) {
    					return item.el.children('img').attr('alt');
    				}
    			},
    			tClose: su_magnific_popup.close,
    			tLoading: su_magnific_popup.loading
    		});
    		magnificPopupI=$.magnificPopup.instance;
    		$('.su-lightbox-gallery').on('mfpOpen', function(e /*, params */) {
    			  console.log($.magnificPopup.instance.items);
    			});
    	});

    maybe for the next update…

    enjoy
    Nico Dpared

    https://wordpress.org/plugins/shortcodes-ultimate/

  • The topic ‘Carousel su little hack’ is closed to new replies.