You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
2.1 KiB
57 lines
2.1 KiB
(function ($, Drupal, drupalSettings) { |
|
Drupal.behaviors.mtFlexsliderNodesSlideshow = { |
|
attach: function (context, settings) { |
|
|
|
$(context).find('.nodes-slideshow').once('mtFlexsliderNodesSlideshowShow').each(function() { |
|
$(this).fadeIn("slow"); |
|
}); |
|
|
|
$(context).find('.nodes-slideshow-navigation').once('mtFlexsliderNodesSlideshowNavShow').each(function() { |
|
$(this).fadeIn("slow"); |
|
}); |
|
|
|
// The slider being synced must be initialized first |
|
$(context).find('.nodes-slideshow').once('mtFlexsliderNodesSlideshowInit').each(function() { |
|
var blockId = $(this).closest(".block").attr('id'), |
|
nodesSlideshow = "#" + blockId + " .nodes-slideshow", |
|
nodesSlideshowThumbs = "#" + blockId + " .nodes-slideshow-navigation"; |
|
|
|
$(nodesSlideshowThumbs).flexslider({ |
|
animation: "slide", |
|
controlNav: false, |
|
animationLoop: false, |
|
slideshow: false, |
|
directionNav: false, |
|
prevText: "", |
|
nextText: "", |
|
asNavFor: nodesSlideshow |
|
}); |
|
$(nodesSlideshow).flexslider({ |
|
useCSS: false, |
|
animation: "slide", |
|
controlNav: false, |
|
directionNav: false, |
|
prevText: "", |
|
nextText: "", |
|
animationLoop: false, |
|
slideshow: false, |
|
sync: nodesSlideshowThumbs |
|
}); |
|
}); |
|
|
|
$(context).find('.nodes-slideshow-navigation .slides > li:first-child').once('mtFlexsliderNodesSlideshowSlide').each(function() { |
|
$(this).addClass("is-active"); |
|
}); |
|
$(context).find('.nodes-slideshow-navigation .slides').once('mtFlexsliderNodesSlideshowSlidesTouch').on('touchstart', 'li', function() { |
|
$(this).addClass("is-active"); |
|
$(this).siblings().removeClass("is-active"); |
|
}); |
|
|
|
$(context).find('.nodes-slideshow-navigation .slides').once('mtFlexsliderNodesSlideshowSlides').on('click', 'li', function() { |
|
$(this).addClass("is-active"); |
|
$(this).siblings().removeClass("is-active"); |
|
}); |
|
|
|
} |
|
}; |
|
})(jQuery, Drupal, drupalSettings);
|
|
|