Advertisement
cipher87

slideshow.js

Jun 17th, 2022
1,008
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 40.48 KB | None | 0 0
  1. /* ======================================================================================================================================================
  2. Avia Slideshow
  3. ======================================================================================================================================================
  4. */
  5.  
  6. (function($)
  7. {
  8.     "use strict";
  9.  
  10.     $.AviaSlider = function( options, slider )
  11.     {
  12.         var self = this;
  13.  
  14.         this.$win = $( window );
  15.         this.$slider = $( slider );
  16.  
  17.         this.isMobile = $.avia_utilities.isMobile;
  18.         this.isTouchDevice = $.avia_utilities.isTouchDevice,
  19.  
  20.         this._prepareSlides(options);
  21.  
  22.         //default preload images then init slideshow
  23.         $.avia_utilities.preload({
  24.             container: this.$slider,
  25.             single_callback: function(){ self._init( options ); }
  26.         });
  27.     };
  28.  
  29.     $.AviaSlider.defaults =
  30.     {
  31.         //interval between autorotation switches
  32.         interval: 5,
  33.  
  34.         //start autorotation active or not
  35.         autoplay: false,
  36.  
  37.         //stop on last slide - shortcut for stopinfiniteloop - kept for backwards comp. With 5.0 added extended support also for manual rotation
  38.         autoplay_stopper: false,
  39.  
  40.         // @since 5.0       'endless' | 'once'
  41.         loop_autoplay: 'once',
  42.  
  43.         // @since 5.0       'manual-endless' | 'manual-once'
  44.         loop_manual: 'manual-endless',
  45.  
  46.         //set if the loop will stop at the last/first slide or if the slides will loop infinite
  47.         //set to false for infinite loop, "last" to stop at the last slide or "first" to stop at the first slide
  48.         stopinfiniteloop: false,
  49.  
  50.         //  true to ignore all user navigation
  51.         noNavigation: false,
  52.  
  53.         //fade or slide animation
  54.         animation: 'slide',
  55.  
  56.         //transition speed when switching slide
  57.         transitionSpeed: 900,
  58.  
  59.         //easing method for the transition
  60.         easing: 'easeInOutQuart',
  61.  
  62.         //slide wrapper
  63.         wrapElement: '>ul',
  64.  
  65.         //slide element
  66.         slideElement: '>li',
  67.  
  68.         //pause if mouse cursor is above item
  69.         hoverpause: false,
  70.  
  71.         //attach images as background
  72.         bg_slider: false,
  73.  
  74.         //delay of milliseconds to wait before showing the next slide
  75.         show_slide_delay: 0,
  76.  
  77.         //if slider animation is set to "fade" the fullfade property sets the crossfade behaviour
  78.         fullfade: false,
  79.  
  80.         //set to true to keep padding (e.g. for featured image slideshow, carousel slideshow
  81.         keep_padding: false,
  82.  
  83.         //enable carousel mode with multiple visible slides
  84.         carousel: 'no',
  85.  
  86.         // how many slides are displayed at once in the carousel
  87.         carouselSlidesToShow: 3,
  88.  
  89.         // TODO: how many slides are scrolled in the carousel
  90.         carouselSlidesToScroll: 1,
  91.  
  92.         // responsive carousel
  93.         carouselResponsive: new Array()
  94.  
  95.     };
  96.  
  97.     $.AviaSlider.prototype =
  98.     {
  99.         _init: function( options )
  100.         {
  101.             // set slider options
  102.             this.options = this._setOptions( options );
  103.  
  104.             //slidewrap
  105.             this.$sliderUl = this.$slider.find(this.options.wrapElement);
  106.  
  107.             // slide elements
  108.             this.$slides = this.$sliderUl.find(this.options.slideElement);
  109.  
  110.             //  slide navigaton arrows wrap
  111.             this.slide_arrows = this.$slider.find( '.avia-slideshow-arrows' );
  112.  
  113.             // goto dots
  114.             this.gotoButtons = this.$slider.find( '.avia-slideshow-dots a' );
  115.  
  116.             //perma caption
  117.             this.permaCaption = this.$slider.find( '>.av-slideshow-caption' );
  118.  
  119.             // slide count
  120.             this.itemsCount = this.$slides.length;
  121.  
  122.             // current image index
  123.             this.current = 0;
  124.  
  125.             // current carousel index
  126.             this.currentCarousel = 0;
  127.  
  128.             // carousel slide width
  129.             this.slideWidthCarousel = '240';
  130.  
  131.             //loop count
  132.             this.loopCount = 0;
  133.  
  134.             // control if the slicebox is animating
  135.             this.isAnimating = false;
  136.  
  137.             // css browser prefix like -webkit-, -moz-
  138.             this.browserPrefix = $.avia_utilities.supports('transition');
  139.  
  140.             // css3 animation?
  141.             this.cssActive = this.browserPrefix !== false ? true : false;
  142.  
  143.             // css3D animation?
  144.             this.css3DActive = document.documentElement.className.indexOf('avia_transform3d') !== -1 ? true : false;
  145.  
  146.             //if we have a bg slider no images were preloaded yet. in that case start preloading and attaching images
  147.             if( this.options.bg_slider == true )
  148.             {
  149.                 //create array that holds all image urls to preload
  150.                 this.imageUrls = [];
  151.  
  152.                 //create a preloader icon to indicate loading
  153.                 this.loader = $.avia_utilities.loading( this.$slider );
  154.  
  155.                 //preload the images ony by one
  156.                 this._bgPreloadImages();
  157.  
  158.             }
  159.             else //if it was a default slider all images are already loaded and we can start showing the slider
  160.             {
  161.                 //kickoff the slider: bind functions, show first slide, if active start the autorotation timer
  162.                 this._kickOff();
  163.             }
  164.  
  165.             if( this.options.carousel === 'yes' )
  166.             {
  167.                 this.options.animation = 'carouselslide';
  168.             }
  169.         },
  170.  
  171.         //set the slider options by first merging the default options and the passed options, then checking the slider element if any data attributes overwrite the option set
  172.         _setOptions: function( options )
  173.         {
  174.             var jsonOptions = this.$slider.data( 'slideshow-options' );
  175.  
  176.             //  since 5.0 - render options via json to clean up html - $.data returns parsed object
  177.             if( 'object' == typeof jsonOptions )
  178.             {
  179.                 var newOptions = $.extend( {}, $.AviaSlider.defaults, options, jsonOptions );
  180.  
  181.                 if( 'undefined' != typeof newOptions.transition_speed )
  182.                 {
  183.                     newOptions.transitionSpeed = newOptions.transition_speed;
  184.                 }
  185.  
  186.                 return newOptions;
  187.             }
  188.  
  189.             var newOptions = $.extend( true, {}, $.AviaSlider.defaults, options ),
  190.                 htmlData = this.$slider.data();
  191.  
  192.             //overwrite passed option set with any data properties on the html element
  193.             for( var i in htmlData )
  194.             {
  195.                 //  data attribute is transformed to lower case, but js is case sensitive - transform key
  196.                 var key = ( 'transition_speed' != i ) ? i :'transitionSpeed';
  197.  
  198.                 if( typeof htmlData[ i ] === "string" || typeof htmlData[ i ] === "number" || typeof htmlData[ i ] === "boolean" )
  199.                 {
  200.                     newOptions[ key ] = htmlData[ i ];
  201.                 }
  202.  
  203.                 if( 'undefined' != typeof newOptions.autoplay_stopper && newOptions.autoplay_stopper == 1 )
  204.                 {
  205.                     newOptions.autoplay_stopper = true;
  206.                 }
  207.             }
  208.  
  209.             return newOptions;
  210.         },
  211.  
  212.         _prepareSlides: function (options)
  213.         {
  214.             var video_slide = this.$slider.find('.av-video-slide');
  215.  
  216.             //if its a mobile device find all video slides that need to be altered
  217.             if (this.isMobile)
  218.             {
  219.                 video_slide.each(function ()
  220.                 {
  221.                     if ($(this).is('.av-mobile-fallback-image') == false) return;
  222.  
  223.                     var current = $(this).removeClass('av-video-slide').data({ 'avia_video_events': true, 'video-ratio': 0 }),
  224.                         fallback = current.data('mobile-img'),
  225.                         fallback_link = current.data('fallback-link'),
  226.                         appendTo = current.find('.avia-slide-wrap');
  227.  
  228.                     current.find('.av-click-overlay, .mejs-mediaelement, .mejs-container').remove();
  229.  
  230.                     if (!fallback)
  231.                     {
  232.                         $('<p class="av-fallback-message"><span>Please set a mobile device fallback image for this video in your wordpress backend</span></p>').appendTo(appendTo);
  233.                     }
  234.  
  235.                     if (options && options.bg_slider)
  236.                     {
  237.                         current.data('img-url', fallback);
  238.  
  239.                         //if we got a fallback link we need to either replace the default link on mobile devices, or if there is no default link change the wrapping <div> to an <a>
  240.                         if (fallback_link != "")
  241.                         {
  242.                             if (appendTo.is('a'))
  243.                             {
  244.                                 appendTo.attr('href', fallback_link);
  245.                             }
  246.                             else
  247.                             {
  248.                                 appendTo.find('a').remove();
  249.                                 appendTo.replaceWith(function ()
  250.                                 {
  251.                                     var cur_slide = $(this);
  252.                                     return $("<a>").attr({ 'data-rel': cur_slide.data('rel'), 'class': cur_slide.attr('class'), 'href': fallback_link }).append($(this).contents());
  253.                                 });
  254.  
  255.                                 appendTo = current.find('.avia-slide-wrap');
  256.                             }
  257.  
  258.                             if ($.fn.avia_activate_lightbox)
  259.                             {
  260.                                 current.parents('#main').avia_activate_lightbox();
  261.                             }
  262.                         }
  263.                     }
  264.                     else
  265.                     {
  266.                         var image = '<img src="' + fallback + '" alt="" title="" />';
  267.                         var lightbox = false;
  268.  
  269.                         if ('string' == typeof fallback_link && fallback_link.trim() != '')
  270.                         {
  271.                             if (appendTo.is('a'))
  272.                             {
  273.                                 appendTo.attr('href', fallback_link);
  274.                             }
  275.                             else
  276.                             {
  277.                                 var rel = fallback_link.match(/\.(jpg|jpeg|gif|png)$/i) != null ? ' rel="lightbox" ' : '';
  278.                                 image = '<a href="' + fallback_link.trim() + '"' + rel + '>' + image + '</a>';
  279.                             }
  280.                             lightbox = true;
  281.                         }
  282.  
  283.                         current.find('.avia-slide-wrap').append(image);
  284.  
  285.                         if (lightbox && $.fn.avia_activate_lightbox)
  286.                         {
  287.                             current.parents('#main').avia_activate_lightbox();
  288.                         }
  289.                     }
  290.  
  291.                 });
  292.             } else
  293.             {
  294.                 video_slide.each(function ()
  295.                 {
  296.                     var current = $(this),
  297.                         current_wrap = current.find('.avia-slide-wrap'),
  298.                         click_overlay = current.find('.av-click-overlay'),
  299.                         section_overlay = current.find('.av-section-color-overlay'),
  300.                         caption = current.find('.av-slideshow-caption'),
  301.                         mejs_inner = current.find('.mejs-inner'),
  302.                         mejs_controls = mejs_inner.find('.mejs-controls'),
  303.                         mejs_volume_slider = mejs_inner.find('.mejs-volume-slider');
  304.  
  305.                     if (!click_overlay.length) return;
  306.  
  307.                     click_overlay.prependTo(mejs_inner);
  308.                     click_overlay.css('z-index', 2);
  309.  
  310.                     if (section_overlay.length)
  311.                     {
  312.                         section_overlay.prependTo(mejs_inner);
  313.                         section_overlay.css('z-index', 1);
  314.                     }
  315.  
  316.                     if (caption.length)
  317.                     {
  318.                         caption.prependTo(mejs_inner);
  319.                         caption.css('z-index', 3);
  320.                     }
  321.  
  322.                     mejs_controls.css('z-index', 4);
  323.  
  324.                     current_wrap.on('mouseover', function (event)
  325.                     {
  326.                         var target = $(event.target);
  327.  
  328.                         if (target.is('.mejs-volume-button') || target.is(":button"))
  329.                         {
  330.                             if (click_overlay.is(':visible'))
  331.                             {
  332.                                 click_overlay.hide();
  333.                             }
  334.                         }
  335.                         else
  336.                         {
  337.                             if (!click_overlay.is(':visible') && !mejs_volume_slider.is(':visible'))
  338.                             {
  339.                                 click_overlay.show();
  340.                             }
  341.                         }
  342.                     });
  343.                 });
  344.             }
  345.         },
  346.        
  347.         //start preloading the background images
  348.         _bgPreloadImages: function(callback)
  349.         {
  350.             this._getImageURLS();
  351.  
  352.             this._preloadSingle(0, function()
  353.             {
  354.                 this._kickOff();
  355.                 this._preloadNext(1);
  356.             });
  357.         },
  358.  
  359.         //if we are using a background image slider, fetch the images from a data attribute and preload them one by one
  360.         _getImageURLS: function()
  361.         {
  362.             var _self = this;
  363.  
  364.             //collect url strings of the images to preload
  365.             this.$slides.each( function(i)
  366.             {
  367.                 _self.imageUrls[i] = [];
  368.                 _self.imageUrls[i]['url'] = $(this).data("img-url");
  369.  
  370.                 //if no image is passed we can set the slide to loaded
  371.                 if(typeof _self.imageUrls[i]['url'] == 'string')
  372.                 {
  373.                     _self.imageUrls[i]['status'] = false;
  374.                 }
  375.                 else
  376.                 {
  377.                     _self.imageUrls[i]['status'] = true;
  378.                 }
  379.             });
  380.         },
  381.  
  382.         _preloadSingle: function(key, callback)
  383.         {
  384.             var _self = this,
  385.                 objImage = new Image();
  386.  
  387.             if( typeof _self.imageUrls[key]['url'] == 'string' )
  388.             {
  389.                 $(objImage).on('load error', function()
  390.                 {
  391.                     _self.imageUrls[key]['status'] = true;
  392.                     _self.$slides.eq(key).css('background-image','url(' + _self.imageUrls[key]['url'] + ')');
  393.  
  394.                     if( typeof callback == 'function' )
  395.                     {
  396.                         callback.apply( _self, [objImage, key] );
  397.                     }
  398.                 });
  399.  
  400.                 if(_self.imageUrls[key]['url'] != "")
  401.                 {
  402.                     objImage.src = _self.imageUrls[key]['url'];
  403.                 }
  404.                 else
  405.                 {
  406.                     $(objImage).trigger('error');
  407.                 }
  408.             }
  409.             else
  410.             {
  411.                 if( typeof callback == 'function' )
  412.                 {
  413.                     callback.apply( _self, [objImage, key] );
  414.                 }
  415.             }
  416.         },
  417.  
  418.         _preloadNext: function(key)
  419.         {
  420.             if(typeof this.imageUrls[key] != "undefined")
  421.             {
  422.                 this._preloadSingle(key, function()
  423.                 {
  424.                     this._preloadNext(key + 1);
  425.                 });
  426.             }
  427.         },
  428.  
  429.  
  430.         //bind click events of slide controlls to the public functions
  431.         _bindEvents: function()
  432.         {
  433.             var self = this,
  434.                 win  = $( window );
  435.  
  436.             this.$slider.on( 'click', '.next-slide', this.next.bind( this ) );
  437.             this.$slider.on( 'click', '.prev-slide', this.previous.bind( this ) );
  438.             this.$slider.on( 'click', '.goto-slide', this.go2.bind( this ) );
  439.  
  440.             if( this.options.hoverpause )
  441.             {
  442.                 this.$slider.on( 'mouseenter', this.pause.bind( this ) );
  443.                 this.$slider.on( 'mouseleave', this.resume.bind( this ) );
  444.             }
  445.  
  446.             //  activate permanent caption link of image
  447.             if( this.permaCaption.length )
  448.             {
  449.                 this.permaCaption.on( 'click', this._routePermaCaptionClick );
  450.                 this.$slider.on( 'avia_slider_first_slide avia_slider_last_slide avia_slider_navigate_slide', this._setPermaCaptionPointer.bind( this ) );
  451.             }
  452.  
  453.             if( this.options.stopinfiniteloop && this.options.autoplay )
  454.             {
  455.                 if( this.options.stopinfiniteloop == 'last' )
  456.                 {
  457.                     this.$slider.on( 'avia_slider_last_slide', this._stopSlideshow.bind( this ) );
  458.                 }
  459.                 else if( this.options.stopinfiniteloop == 'first' )
  460.                 {
  461.                     this.$slider.on( 'avia_slider_first_slide', this._stopSlideshow.bind( this ) );
  462.                 }
  463.             }
  464.  
  465.             if( this.options.carousel === 'yes' )
  466.             {
  467.                 // recalculate carousel dimensions on viewport size change
  468.                 // use on desktop only, debouncedresize fires on scroll on mobile
  469.                 if( ! this.isMobile )
  470.                 {
  471.                     win.on( 'debouncedresize', this._buildCarousel.bind( this ) );
  472.                 }
  473.             }
  474.             else
  475.             {
  476.                 win.on( 'debouncedresize.aviaSlider', this._setSize.bind( this ) );
  477.             }
  478.  
  479.             if( ! this.options.noNavigation )
  480.             {
  481.                 //if its a desktop browser add arrow navigation, otherwise add touch nav (also for touch devices)
  482.                 if( ! this.isMobile )
  483.                 {
  484.                     this.$slider.avia_keyboard_controls();
  485.                 }
  486.  
  487.                 if( this.isMobile || this.isTouchDevice )
  488.                 {
  489.                     this.$slider.avia_swipe_trigger();
  490.                 }
  491.             }
  492.  
  493.             self._attach_video_events();
  494.         },
  495.  
  496.         //kickoff the slider by binding all functions to slides and buttons, show the first slide and start autoplay
  497.         _kickOff: function()
  498.         {
  499.             var self = this,
  500.                 first_slide = self.$slides.eq(0),
  501.                 video = first_slide.data('video-ratio');
  502.  
  503.             // bind events to to the controll buttons
  504.             self._bindEvents();
  505.             self._set_slide_arrows_visibility();
  506.  
  507.             this.$slider.removeClass('av-default-height-applied');
  508.  
  509.             //show the first slide. if its a video set the correct size, otherwise make sure to remove the % padding
  510.             if( video )
  511.             {
  512.                 self._setSize( true );
  513.             }
  514.             else
  515.             {
  516.                 if( this.options.keep_padding != true )
  517.                 {
  518.                     self.$sliderUl.css('padding',0);
  519.                     self.$win.trigger('av-height-change');
  520.                 }
  521.             }
  522.  
  523.             self._setCenter();
  524.  
  525.             if( this.options.carousel === 'no' )
  526.             {
  527.                 first_slide.addClass( 'next-active-slide' );
  528.                 first_slide.css( {visibility:'visible', opacity:0} ).avia_animate( {opacity:1}, function()
  529.                 {
  530.                     var current = $(this).addClass( 'active-slide' );
  531.  
  532.                     if( self.permaCaption.length )
  533.                     {
  534.                         self.permaCaption.addClass( 'active-slide' );
  535.                     }
  536.                 });
  537.             }
  538.  
  539.             self.$slider.trigger( 'avia_slider_first_slide' );
  540.  
  541.  
  542.             // start autoplay if active
  543.             if( self.options.autoplay )
  544.             {
  545.                 self._startSlideshow();
  546.             }
  547.  
  548.             // prepare carousel if active
  549.             if( self.options.carousel === 'yes' )
  550.             {
  551.                 self._buildCarousel();
  552.             }
  553.  
  554.             self.$slider.trigger( '_kickOff' );
  555.         },
  556.  
  557.         _set_slide_arrows_visibility: function()
  558.         {
  559.             //  special use case - hardcoded as only used in timeline
  560.             if( this.options.carousel == 'yes' )
  561.             {
  562.                 if( 0 == this.currentCarousel )
  563.                 {
  564.                     this.slide_arrows.removeClass( 'av-visible-prev' );
  565.                     this.slide_arrows.addClass( 'av-visible-next' );
  566.                 }
  567.                 else if( this.currentCarousel + this.options.carouselSlidesToShow >= this.itemsCount )
  568.                 {
  569.                     this.slide_arrows.addClass( 'av-visible-prev' );
  570.                     this.slide_arrows.removeClass( 'av-visible-next' );
  571.                 }
  572.                 else
  573.                 {
  574.                     this.slide_arrows.addClass( 'av-visible-prev' );
  575.                     this.slide_arrows.addClass( 'av-visible-next' );
  576.                 }
  577.  
  578.                 return;
  579.             }
  580.  
  581.             if( 'endless' == this.options.loop_autoplay || 'manual-endless' == this.options.loop_manual )
  582.             {
  583.                 this.slide_arrows.addClass( 'av-visible-prev' );
  584.                 this.slide_arrows.addClass( 'av-visible-next' );
  585.             }
  586.             else if( 0 == this.current )
  587.             {
  588.                 this.slide_arrows.removeClass( 'av-visible-prev' );
  589.                 this.slide_arrows.addClass( 'av-visible-next' );
  590.             }
  591.             else if( this.current + 1 >= this.itemsCount )
  592.             {
  593.                 this.slide_arrows.addClass( 'av-visible-prev' );
  594.                 this.slide_arrows.removeClass( 'av-visible-next' );
  595.             }
  596.             else
  597.             {
  598.                 this.slide_arrows.addClass( 'av-visible-prev' );
  599.                 this.slide_arrows.addClass( 'av-visible-next' );
  600.             }
  601.         },
  602.  
  603.         _buildCarousel: function()
  604.         {
  605.             var self = this,
  606.             stageWidth = this.$slider.outerWidth(),
  607.             slidesWidth = parseInt(stageWidth / this.options.carouselSlidesToShow),
  608.             windowWidth = window.innerWidth || $(window).width();
  609.  
  610.             // responsive carousel
  611.             if( this.options.carouselResponsive &&
  612.                 this.options.carouselResponsive.length &&
  613.                 this.options.carouselResponsive !== null )
  614.             {
  615.  
  616.                 for( var breakpoint in this.options.carouselResponsive )
  617.                 {
  618.                     var breakpointValue = this.options.carouselResponsive[breakpoint]['breakpoint'];
  619.                     var newSlidesToShow = this.options.carouselResponsive[breakpoint]['settings']['carouselSlidesToShow'];
  620.  
  621.                     if( breakpointValue >= windowWidth )
  622.                     {
  623.                         slidesWidth = parseInt(stageWidth / newSlidesToShow);
  624.                         this.options.carouselSlidesToShow = newSlidesToShow;
  625.                     }
  626.                 }
  627.             }
  628.  
  629.             // set width and height for each slide
  630.             this.slideWidthCarousel = slidesWidth;
  631.  
  632.             this.$slides.each(function(i)
  633.             {
  634.                 $(this).width(slidesWidth);
  635.             });
  636.  
  637.             // set width for the UL
  638.             var slideTrackWidth = slidesWidth * this.itemsCount;
  639.             this.$sliderUl.width(slideTrackWidth).css( 'transform', 'translateX(0px)' );
  640.  
  641.             // hide nav if not needed
  642.             if( this.options.carouselSlidesToShow >= this.itemsCount )
  643.             {
  644.                 this.$slider.find('.av-timeline-nav').hide();
  645.             }
  646.         },
  647.  
  648.         //calculate which slide should be displayed next and call the executing transition function
  649.         _navigate: function( dir, pos )
  650.         {
  651.             if( this.isAnimating || this.itemsCount < 2 || ! this.$slider.is( ':visible' ) )
  652.             {
  653.                 return false;
  654.             }
  655.  
  656.             this.isAnimating = true;
  657.  
  658.             // current item's index
  659.             this.prev = this.current;
  660.  
  661.             // if position is passed
  662.             if( pos !== undefined )
  663.             {
  664.                 this.current = pos;
  665.                 dir = this.current > this.prev ? 'next' : 'prev';
  666.             }
  667.  
  668.             // if not check the boundaries
  669.             else if( dir === 'next' )
  670.             {
  671.                 this.current = this.current < this.itemsCount - 1 ? this.current + 1 : 0;
  672.  
  673.                 if( this.current === 0 && this.options.autoplay_stopper && this.options.autoplay )
  674.                 {
  675.                     this.isAnimating = false;
  676.                     this.current = this.prev;
  677.                     this._stopSlideshow();
  678.                     return false;
  679.                 }
  680.  
  681.                 //  check if we can rotate
  682.                 if( 0 === this.current )
  683.                 {
  684.                     if( 'endless' != this.options.loop_autoplay && 'manual-endless' != this.options.loop_manual )
  685.                     {
  686.                         this.isAnimating = false;
  687.                         this.current = this.prev;
  688.                         return false;
  689.                     }
  690.                 }
  691.             }
  692.             else if( dir === 'prev' )
  693.             {
  694.                 this.current = this.current > 0 ? this.current - 1 : this.itemsCount - 1;
  695.  
  696.                 //  check if we can rotate
  697.                 if( this.itemsCount - 1 === this.current )
  698.                 {
  699.                     if( 'endless' != this.options.loop_autoplay && 'manual-endless' != this.options.loop_manual )
  700.                     {
  701.                         this.isAnimating = false;
  702.                         this.current = this.prev;
  703.                         return false;
  704.                     }
  705.                 }
  706.             }
  707.  
  708.             //set goto button
  709.             this.gotoButtons.removeClass( 'active' ).eq( this.current ).addClass( 'active' );
  710.             this._set_slide_arrows_visibility();
  711.  
  712.             //set slideshow size if carousel not in use
  713.             if( this.options.carousel === 'no' )
  714.             {
  715.                 this._setSize();
  716.             }
  717.  
  718.             //if we are using a background slider make sure that the image is loaded. if not preload it, then show the slide
  719.             if( this.options.bg_slider == true )
  720.             {
  721.                 if( this.imageUrls[this.current]['status'] == true )
  722.                 {
  723.                     this['_' + this.options.animation].call(this, dir);
  724.                 }
  725.                 else
  726.                 {
  727.                     this.loader.show();
  728.                     this._preloadSingle(this.current, function()
  729.                     {
  730.                         this['_' + this.options.animation].call( this, dir );
  731.                         this.loader.hide();
  732.                     });
  733.                 }
  734.             }
  735.             else //no background loader -> images are already loaded
  736.             {
  737.                 //call the executing function. for example _slide, or _fade. since the function call is absed on a var we can easily extend the slider with new animations
  738.                 this['_' + this.options.animation].call( this, dir );
  739.             }
  740.  
  741.             if( this.current == 0 )
  742.             {
  743.                 this.loopCount++;
  744.                 this.$slider.trigger( 'avia_slider_first_slide' );
  745.             }
  746.             else if( this.current == this.itemsCount - 1 )
  747.             {
  748.                 this.$slider.trigger( 'avia_slider_last_slide' );
  749.             }
  750.             else
  751.             {
  752.                 this.$slider.trigger( 'avia_slider_navigate_slide' );
  753.             }
  754.         },
  755.  
  756.         //if the next slide has a different height than the current change the slideshow height
  757.         _setSize: function(instant)
  758.         {
  759.             //if images are attached as bg images the slider has a fixed height
  760.             if( this.options.bg_slider == true )
  761.             {
  762.                 return;
  763.             }
  764.  
  765.             var self            = this,
  766.                 slide           = this.$slides.eq(this.current),
  767.                 img             = slide.find('img'),
  768.                 current         = Math.floor(this.$sliderUl.height()),
  769.                 ratio           = slide.data('video-ratio'),
  770.                 setTo           = ratio ? this.$sliderUl.width() / ratio : Math.floor(slide.height()),
  771.                 video_height    = slide.data('video-height'), //forced video height %. needs to be set only once
  772.                 video_toppos    = slide.data('video-toppos'); //forced video top position
  773.  
  774.             this.$sliderUl.height(current).css('padding',0); //make sure to set the slideheight to an actual value
  775.  
  776.             if(setTo != current)
  777.             {
  778.                 if(instant == true)
  779.                 {
  780.                     this.$sliderUl.css({height:setTo});
  781.                     this.$win.trigger('av-height-change');
  782.                 }
  783.                 else
  784.                 {
  785.                     this.$sliderUl.avia_animate({height:setTo}, function()
  786.                     {
  787.                         self.$win.trigger('av-height-change');
  788.                     });
  789.                 }
  790.             }
  791.  
  792.             this._setCenter();
  793.  
  794.             if(video_height && video_height!= "set")
  795.             {
  796.                 slide.find('iframe, embed, video, object, .av_youtube_frame').css({height: video_height + '%', top: video_toppos + '%'});
  797.                 slide.data('video-height','set');
  798.             }
  799.         },
  800.  
  801.         _setCenter: function()
  802.         {
  803.             //if the image has a min width and is larger than the slider center it
  804.             //positon img based on caption. right caption->left pos, left caption -> right pos
  805.             var slide       = this.$slides.eq(this.current),
  806.                 img         = slide.find('img'),
  807.                 min_width   = parseInt(img.css('min-width'),10),
  808.                 slide_width = slide.width(),
  809.                 caption     = slide.find('.av-slideshow-caption'),
  810.                 css_left    = ((slide_width - min_width) / 2);
  811.  
  812.             if(caption.length)
  813.             {
  814.                 if(caption.is('.caption_left'))
  815.                 {
  816.                     css_left = ((slide_width - min_width) / 1.5);
  817.                 }
  818.                 else if(caption.is('.caption_right'))
  819.                 {
  820.                     css_left = ((slide_width - min_width) / 2.5);
  821.                 }
  822.             }
  823.  
  824.             if(slide_width >= min_width)
  825.             {
  826.                 css_left = 0;
  827.             }
  828.  
  829.             img.css({left:css_left});
  830.         },
  831.  
  832.         _carouselmove : function(){
  833.  
  834.         //    var offset = (this.options.carouselSlidesToScroll*this.slideWidthCarousel)*this.currentCarousel;
  835.             var offset = this.slideWidthCarousel * this.currentCarousel;
  836.             this.$sliderUl.css('transform', 'translateX(-' + offset + 'px)');
  837.         },
  838.  
  839.         _carouselslide: function(dir)
  840.         {
  841.             console.log( '_carouselslide:', dir, this.currentCarousel );
  842.  
  843.             if( dir === 'next' )
  844.             {
  845.                 if (this.options.carouselSlidesToShow + this.currentCarousel < this.itemsCount)
  846.                 {
  847.                     this.currentCarousel++;
  848.                     this._carouselmove();
  849.                 }
  850.             }
  851.             else if( dir === 'prev' )
  852.             {
  853.                 if( this.currentCarousel > 0 )
  854.                 {
  855.                     this.currentCarousel--;
  856.                     this._carouselmove();
  857.                 }
  858.             }
  859.  
  860.             this._set_slide_arrows_visibility();
  861.  
  862.             this.isAnimating = false;
  863.         },
  864.  
  865.         _slide: function(dir)
  866.         {
  867.             var dynamic         = false, //todo: pass by option if a slider is dynamic
  868.                 modifier        = dynamic == true ? 2 : 1,
  869.                 sliderWidth     = this.$slider.width(),
  870.                 direction       = dir === 'next' ? -1 : 1,
  871.                 property        = this.browserPrefix + 'transform',
  872.                 reset           = {},
  873.                 transition = {},
  874.                 transition2 = {},
  875.                 trans_val       = ( sliderWidth * direction * -1 ),
  876.                 trans_val2      = ( sliderWidth * direction ) / modifier;
  877.  
  878.             //do a css3 animation
  879.             if(this.cssActive)
  880.             {
  881.                 property = this.browserPrefix + 'transform';
  882.  
  883.                 //do a translate 3d transformation if available, since it uses hardware acceleration
  884.                 if(this.css3DActive)
  885.                 {
  886.                     reset[property]  = "translate3d(" + trans_val + "px, 0, 0)";
  887.                     transition[property]  = "translate3d(" + trans_val2 + "px, 0, 0)";
  888.                     transition2[property] = "translate3d(0,0,0)";
  889.                 }
  890.                 else //do a 2d transform. still faster than a position "left" change
  891.                 {
  892.                     reset[property]  = "translate(" + trans_val + "px,0)";
  893.                     transition[property]  = "translate(" + trans_val2 + "px,0)";
  894.                     transition2[property] = "translate(0,0)";
  895.                 }
  896.             }
  897.             else
  898.             {
  899.                 reset.left = trans_val;
  900.                 transition.left = trans_val2;
  901.                 transition2.left = 0;
  902.             }
  903.  
  904.             if(dynamic)
  905.             {
  906.                 transition['z-index']  = "1";
  907.                 transition2['z-index']  = "2";
  908.             }
  909.  
  910.             this._slide_animate(reset, transition, transition2);
  911.         },
  912.  
  913.         _slide_up: function(dir)
  914.         {
  915.             var dynamic         = true, //todo: pass by option if a slider is dynamic
  916.                 modifier        = dynamic == true ? 2 : 1,
  917.                 sliderHeight    = this.$slider.height(),
  918.                 direction       = dir === 'next' ? -1 : 1,
  919.                 property        = this.browserPrefix + 'transform',
  920.                 reset           = {},
  921.                 transition = {},
  922.                 transition2 = {},
  923.                 trans_val       = ( sliderHeight * direction * -1),
  924.                 trans_val2      = ( sliderHeight * direction) / modifier;
  925.  
  926.             //do a css3 animation
  927.             if(this.cssActive)
  928.             {
  929.                 property  = this.browserPrefix + 'transform';
  930.  
  931.                 //do a translate 3d transformation if available, since it uses hardware acceleration
  932.                 if(this.css3DActive)
  933.                 {
  934.                     reset[property]  = "translate3d( 0," + trans_val + "px, 0)";
  935.                     transition[property]  = "translate3d( 0," + trans_val2 + "px, 0)";
  936.                     transition2[property] = "translate3d(0,0,0)";
  937.                 }
  938.                 else //do a 2d transform. still faster than a position "left" change
  939.                 {
  940.                     reset[property]  = "translate( 0," + trans_val + "px)";
  941.                     transition[property]  = "translate( 0," + trans_val2 + "px)";
  942.                     transition2[property] = "translate(0,0)";                   }
  943.             }
  944.             else
  945.             {
  946.                 reset.top = trans_val;
  947.                 transition.top = trans_val2;
  948.                 transition2.top = 0;
  949.             }
  950.  
  951.             if(dynamic)
  952.             {
  953.                 transition['z-index']  = "1";
  954.                 transition2['z-index']  = "2";
  955.             }
  956.             this._slide_animate(reset, transition, transition2);
  957.         },
  958.  
  959.  
  960.         //slide animation: do a slide transition by css3 transform if possible. if not simply do a position left transition
  961.         _slide_animate: function( reset , transition , transition2 )
  962.         {
  963.             var self            = this,
  964.                 displaySlide    = this.$slides.eq(this.current),
  965.                 hideSlide       = this.$slides.eq(this.prev);
  966.  
  967.             hideSlide.trigger('pause');
  968.             if( ! displaySlide.data('disableAutoplay') )
  969.             {
  970.                 if(displaySlide.hasClass('av-video-lazyload') && !displaySlide.hasClass('av-video-lazyload-complete'))
  971.                 {
  972.                     displaySlide.find('.av-click-to-play-overlay').trigger('click');
  973.                 }
  974.                 else
  975.                 {
  976.                     displaySlide.trigger('play');
  977.                 }
  978.             }
  979.  
  980.             displaySlide.css({visibility:'visible', zIndex:4, opacity:1, left:0, top:0});
  981.             displaySlide.css(reset);
  982.  
  983.             hideSlide.avia_animate(transition, this.options.transitionSpeed, this.options.easing);
  984.  
  985.             var after_slide = function()
  986.             {
  987.                 self.isAnimating = false;
  988.                 displaySlide.addClass( 'active-slide' );
  989.                 hideSlide.css( {visibility:'hidden'} ).removeClass( 'active-slide next-active-slide' );
  990.                 self.$slider.trigger( 'avia-transition-done' );
  991.             };
  992.  
  993.             if( self.options.show_slide_delay > 0 )
  994.             {
  995.                 setTimeout( function()
  996.                 {
  997.                     displaySlide.addClass( 'next-active-slide' );
  998.                     displaySlide.avia_animate( transition2, self.options.transitionSpeed, self.options.easing, after_slide );
  999.                 }, self.options.show_slide_delay );
  1000.             }
  1001.             else
  1002.             {
  1003.                 displaySlide.addClass( 'next-active-slide' );
  1004.                 displaySlide.avia_animate( transition2, self.options.transitionSpeed, self.options.easing, after_slide );
  1005.             }
  1006.         },
  1007.  
  1008.         //simple fade transition of the slideshow
  1009.         _fade: function()
  1010.         {
  1011.             var self            = this,
  1012.                 displaySlide    = this.$slides.eq(this.current),
  1013.                 hideSlide       = this.$slides.eq(this.prev),
  1014.                 properties      = {visibility:'visible', zIndex:3, opacity:0},
  1015.                 fadeCallback    = function()
  1016.                 {
  1017.                     self.isAnimating = false;
  1018.                     displaySlide.addClass( 'active-slide' );
  1019.                     hideSlide.css({visibility:'hidden', zIndex:2}).removeClass( 'active-slide next-active-slide' );
  1020.                     self.$slider.trigger( 'avia-transition-done' );
  1021.                 };
  1022.  
  1023.             hideSlide.trigger('pause');
  1024.  
  1025.             if( ! displaySlide.data('disableAutoplay') )
  1026.             {
  1027.                 if(displaySlide.hasClass('av-video-lazyload') && ! displaySlide.hasClass('av-video-lazyload-complete'))
  1028.                 {
  1029.                     displaySlide.find('.av-click-to-play-overlay').trigger('click');
  1030.                 }
  1031.                 else
  1032.                 {
  1033.                     displaySlide.trigger('play');
  1034.                 }
  1035.             }
  1036.  
  1037.             displaySlide.addClass( 'next-active-slide' );
  1038.  
  1039.             if( self.options.fullfade == true )
  1040.             {
  1041.                 hideSlide.avia_animate( {opacity:0}, 200, 'linear', function()
  1042.                 {
  1043.                     displaySlide.css( properties ).avia_animate( {opacity:1}, self.options.transitionSpeed, 'linear', fadeCallback );
  1044.                 });
  1045.             }
  1046.             else
  1047.             {
  1048.                 if( self.current === 0 )
  1049.                 {
  1050.                     hideSlide.avia_animate( {opacity:0}, self.options.transitionSpeed/2, 'linear' );
  1051.                     displaySlide.css(properties).avia_animate( {opacity:1}, self.options.transitionSpeed/2, 'linear', fadeCallback );
  1052.                 }
  1053.                 else
  1054.                 {
  1055.                     displaySlide.css(properties).avia_animate( {opacity:1}, self.options.transitionSpeed/2, 'linear', function()
  1056.                     {
  1057.                         hideSlide.avia_animate({opacity:0}, 200, 'linear', fadeCallback );
  1058.                     });
  1059.                 }
  1060.             }
  1061.         },
  1062.  
  1063.         /************************************************************************
  1064.         Video functions
  1065.         *************************************************************************/
  1066.  
  1067.         //bind events to the video that tell the slider to autorotate once a video has been played
  1068.         _attach_video_events: function()
  1069.         {
  1070.             var self = this,
  1071.                 $html = $('html');
  1072.  
  1073.             self.$slides.each( function(i)
  1074.             {
  1075.                 var currentSlide    = $(this),
  1076.                     caption         = currentSlide.find('.caption_fullwidth, .av-click-overlay'),
  1077.                     mejs            = currentSlide.find('.mejs-mediaelement'),
  1078.                     lazyload        = currentSlide.hasClass('av-video-lazyload') ? true : false;
  1079.  
  1080.  
  1081.                 if( currentSlide.data('avia_video_events') != true )
  1082.                 {
  1083.                     currentSlide.data('avia_video_events', true);
  1084.  
  1085.                     currentSlide.on('av-video-events-bound', { slide: currentSlide, wrap: mejs , iteration: i , self: self, lazyload: lazyload }, onReady);
  1086.  
  1087.                     currentSlide.on('av-video-ended', { slide: currentSlide , self: self}, onFinish);
  1088.  
  1089.                     currentSlide.on('av-video-play-executed', function(){ setTimeout( function(){  self.pause(); }, 100 ); } );
  1090.  
  1091.                     caption.on('click', { slide: currentSlide }, toggle);
  1092.  
  1093.                     // also if the player was loaded before the _bindEvents function was bound trigger it manually
  1094.                     if( currentSlide.is('.av-video-events-bound') )
  1095.                     {
  1096.                         currentSlide.trigger('av-video-events-bound');
  1097.                     }
  1098.  
  1099.                     //if we are on the first slide and autoplay is enabled and lazy loading is enabled we need to simulate a click event to the lazy load container
  1100.                     if( lazyload && i === 0 && ! currentSlide.data('disableAutoplay') )
  1101.                     {
  1102.                         currentSlide.find('.av-click-to-play-overlay').trigger('click');
  1103.                     }
  1104.                 }
  1105.             });
  1106.  
  1107.  
  1108.             //function that takes care of events once the video is loaded for the first time.
  1109.             //needs to take into account 2 different scenarios: normally embedded videos or lazyloaded videos that start on user interaction/autoplay
  1110.             function onReady( event )
  1111.             {
  1112.                 //autostart for first slide
  1113.                 if(event.data.iteration === 0)
  1114.                 {
  1115.                     event.data.wrap.css('opacity',0);
  1116.  
  1117.                     if( ! event.data.self.isMobile && ! event.data.slide.data('disableAutoplay') )
  1118.                     {
  1119.                         event.data.slide.trigger('play');
  1120.                     } 
  1121.  
  1122.                     setTimeout( function(){ event.data.wrap.avia_animate({opacity:1}, 400); }, 50 );
  1123.                 }
  1124.                 else if( $html.is('.avia-msie') && ! event.data.slide.is('.av-video-service-html5') )
  1125.                 {
  1126.                     /*
  1127.                     * Internet Explorer fires the ready event for external videos once they become visible
  1128.                     * as oposed to other browsers which always fire immediately.
  1129.                     */
  1130.                     if( ! event.data.slide.data('disableAutoplay') )
  1131.                     {
  1132.                         event.data.slide.trigger('play');
  1133.                     }
  1134.                 }
  1135.  
  1136.  
  1137.                 //make sure that the html5 element does not play if autoply is enabled but its not the first slide.
  1138.                 //the autoplay attribute on the video element might cause this
  1139.                 if( event.data.slide.is('.av-video-service-html5') && event.data.iteration !== 0 )
  1140.                 {
  1141.                     event.data.slide.trigger('pause');
  1142.                 }
  1143.  
  1144.                 //make sure that lazyloaded videos always get started once a user clicks them
  1145.                 if( event.data.lazyload)
  1146.                 {
  1147.                     event.data.slide.addClass('av-video-lazyload-complete');
  1148.                     event.data.slide.trigger('play');
  1149.                 }
  1150.             }
  1151.  
  1152.             function onFinish( event )
  1153.             {
  1154.                 //if the video is not looped resume the slideshow
  1155.                 if( ! event.data.slide.is('.av-single-slide') && ! event.data.slide.is('.av-loop-video') )
  1156.                 {
  1157.                     event.data.slide.trigger('reset');
  1158.                     self._navigate( 'next' );
  1159.                     self.resume();
  1160.                 }
  1161.  
  1162.                 //safari 8 workaround for self hosted videos which wont loop by default
  1163.                 if( event.data.slide.is('.av-loop-video') && event.data.slide.is('.av-video-service-html5') )
  1164.                 {
  1165.                     if( $html.is('.avia-safari-8') )
  1166.                     {
  1167.                         setTimeout( function()
  1168.                         {
  1169.                             event.data.slide.trigger('play');
  1170.                         }, 1 );
  1171.                     }
  1172.                 }
  1173.             }
  1174.  
  1175.             function toggle( event )
  1176.             {
  1177.                 if( event.target.tagName != "A" )
  1178.                 {
  1179.                     event.data.slide.trigger('toggle');
  1180.                 }
  1181.             }
  1182.         },
  1183.  
  1184.  
  1185.         /************************************************************************
  1186.         Slideshow control functions
  1187.         *************************************************************************/
  1188.  
  1189.         _timer: function(callback, delay, first)
  1190.         {
  1191.             var self = this,
  1192.                 start,
  1193.                 remaining = delay;
  1194.  
  1195.             self.timerId = 0;
  1196.  
  1197.             this.pause = function()
  1198.             {
  1199.                 window.clearTimeout(self.timerId);
  1200.                 remaining -= new Date() - start;
  1201.             };
  1202.  
  1203.             this.resume = function()
  1204.             {
  1205.                 start = new Date();
  1206.                 self.timerId = window.setTimeout(callback, remaining);
  1207.             };
  1208.  
  1209.             this.destroy = function()
  1210.             {
  1211.                 window.clearTimeout(self.timerId);
  1212.             };
  1213.  
  1214.             this.resume(true);
  1215.         },
  1216.  
  1217.         //start autorotation
  1218.         _startSlideshow: function()
  1219.         {
  1220.             var self = this;
  1221.  
  1222.             this.isPlaying = true;
  1223.  
  1224.             this.slideshow = new this._timer( function()
  1225.             {
  1226.                 self._navigate( 'next' );
  1227.  
  1228.                 if( self.options.autoplay )
  1229.                 {
  1230.                     self._startSlideshow();
  1231.                 }
  1232.             }, ( this.options.interval * 1000 ) );
  1233.         },
  1234.  
  1235.         //stop autorotation
  1236.         _stopSlideshow: function()
  1237.         {
  1238.             if( this.options.autoplay )
  1239.             {
  1240.                 this.slideshow.destroy();
  1241.                 this.isPlaying = false;
  1242.                 this.options.autoplay = false;
  1243.             }
  1244.  
  1245.             this.options.autoplay = false;
  1246.             this.options.loop_autoplay = 'once';
  1247.             this.$slider.removeClass( 'av-slideshow-autoplay' ).addClass( 'av-slideshow-manual' );
  1248.             this.$slider.removeClass( 'av-loop-endless' ).addClass( 'av-loop-once' );
  1249.         },
  1250.  
  1251.         //  check if we have a link for the image and set cursor
  1252.         _setPermaCaptionPointer: function( e )
  1253.         {
  1254.             if( ! this.permaCaption.length )
  1255.             {
  1256.                 return;
  1257.             }
  1258.  
  1259.             var withLink = $( this.$slides[this.current] ).find( 'a' ).length;
  1260.             this.permaCaption.css( 'cursor', withLink ? 'pointer' : 'default' );
  1261.         },
  1262.  
  1263.         //  route perma caption to actual link of image, else allow bubble (e.g. for buttons)
  1264.         _routePermaCaptionClick: function( e )
  1265.         {
  1266.             var active_slide_link = $(this).siblings( '.avia-slideshow-inner' ).find( '>.active-slide a' );
  1267.  
  1268.             if( active_slide_link.length )
  1269.             {
  1270.                 e.preventDefault();
  1271.  
  1272.                 //  jQuery trigger does not work !!!
  1273.                 active_slide_link[0].click();
  1274.             }
  1275.         },
  1276.  
  1277.         // public method: shows next image
  1278.         next: function(e)
  1279.         {
  1280.             e.preventDefault();
  1281.             this._stopSlideshow();
  1282.             this._navigate( 'next' );
  1283.         },
  1284.  
  1285.         // public method: shows previous image
  1286.         previous: function(e)
  1287.         {
  1288.             e.preventDefault();
  1289.             this._stopSlideshow();
  1290.             this._navigate( 'prev' );
  1291.         },
  1292.  
  1293.         // public method: goes to a specific image
  1294.         go2: function( pos )
  1295.         {
  1296.             //if we didnt pass a number directly lets asume someone clicked on a link that triggered the goto transition
  1297.             if(isNaN(pos))
  1298.             {
  1299.                 //in that case prevent the default link behavior and set the slide number to the links hash
  1300.                 pos.preventDefault();
  1301.                 pos = pos.currentTarget.hash.replace('#','');
  1302.             }
  1303.  
  1304.             pos -= 1;
  1305.  
  1306.             if( pos === this.current || pos >= this.itemsCount || pos < 0 )
  1307.             {
  1308.                 return false;
  1309.             }
  1310.  
  1311.             this._stopSlideshow();
  1312.             this._navigate( false, pos );
  1313.  
  1314.         },
  1315.  
  1316.         // public method: starts the slideshow
  1317.         // any call to next(), previous() or goto() will stop the slideshow autoplay
  1318.         play: function()
  1319.         {
  1320.             if( !this.isPlaying )
  1321.             {
  1322.                 this.isPlaying = true;
  1323.  
  1324.                 this._navigate( 'next' );
  1325.                 this.options.autoplay = true;
  1326.                 this._startSlideshow();
  1327.             }
  1328.  
  1329.         },
  1330.  
  1331.         // public methos: pauses the slideshow
  1332.         pause: function()
  1333.         {
  1334.             if( this.isPlaying )
  1335.             {
  1336.                 this.slideshow.pause();
  1337.             }
  1338.         },
  1339.  
  1340.         // publiccmethos: resumes the slideshow
  1341.         resume: function()
  1342.         {
  1343.             if( this.isPlaying )
  1344.             {
  1345.                 this.slideshow.resume();
  1346.             }
  1347.         },
  1348.  
  1349.         // public methos: destroys the instance
  1350.         destroy: function( callback )
  1351.         {
  1352.             this.slideshow.destroy( callback );
  1353.         }
  1354.     };
  1355.  
  1356.     //simple wrapper to call the slideshow. makes sure that the slide data is not applied twice
  1357.     $.fn.aviaSlider = function( options )
  1358.     {
  1359.         return this.each(function()
  1360.         {
  1361.             var self = $.data( this, 'aviaSlider' );
  1362.  
  1363.             if( ! self )
  1364.             {
  1365.                 self = $.data( this, 'aviaSlider', new $.AviaSlider( options, this ) );
  1366.             }
  1367.         });
  1368.     };
  1369.  
  1370. })( jQuery );
  1371.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement