/*
* jQuery FlexSlider v2.2.2
* Copyright 2012 WooThemes
* Contributing Author: Tyler Smith
*/
;
(function ($) {
//FlexSlider: Object Instance
$.flexslider = function(el, options) {
var mob_slider = $(el);
// making variables public
mob_slider.vars = $.extend({}, $.flexslider.defaults, options);
var namespace = mob_slider.vars.namespace,
msGesture = window.navigator && window.navigator.msPointerEnabled && window.MSGesture,
touch = (( "ontouchstart" in window ) || msGesture || window.DocumentTouch && document instanceof DocumentTouch) && mob_slider.vars.touch,
// depricating this idea, as devices are being released with both of these events
//eventType = (touch) ? "touchend" : "click",
eventType = "click touchend MSPointerUp",
watchedEvent = "",
watchedEventClearTimer,
vertical = mob_slider.vars.direction === "vertical",
reverse = mob_slider.vars.reverse,
carousel = (mob_slider.vars.itemWidth > 0),
fade = mob_slider.vars.animation === "fade",
asNav = mob_slider.vars.asNavFor !== "",
methods = {},
focused = true;
// Store a reference to the slider object
$.data(el, "flexslider", mob_slider);
// Private slider methods
methods = {
init: function() {
mob_slider.animating = false;
// Get current slide and make sure it is a number
mob_slider.currentSlide = parseInt( ( mob_slider.vars.startAt ? mob_slider.vars.startAt : 0), 10 );
if ( isNaN( mob_slider.currentSlide ) ) mob_slider.currentSlide = 0;
mob_slider.animatingTo = mob_slider.currentSlide;
mob_slider.atEnd = (mob_slider.currentSlide === 0 || mob_slider.currentSlide === mob_slider.last);
mob_slider.containerSelector = mob_slider.vars.selector.substr(0,mob_slider.vars.selector.search(' '));
mob_slider.slides = $(mob_slider.vars.selector, mob_slider);
mob_slider.container = $(mob_slider.containerSelector, mob_slider);
mob_slider.count = mob_slider.slides.length;
// SYNC:
mob_slider.syncExists = $(mob_slider.vars.sync).length > 0;
// SLIDE:
if (mob_slider.vars.animation === "slide") mob_slider.vars.animation = "swing";
mob_slider.prop = (vertical) ? "top" : "marginLeft";
mob_slider.args = {};
// SLIDESHOW:
mob_slider.manualPause = false;
mob_slider.stopped = false;
//PAUSE WHEN INVISIBLE
mob_slider.started = false;
mob_slider.startTimeout = null;
// TOUCH/USECSS:
mob_slider.transitions = !mob_slider.vars.video && !fade && mob_slider.vars.useCSS && (function() {
var obj = document.createElement('div'),
props = ['perspectiveProperty', 'WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective'];
for (var i in props) {
if ( obj.style[ props[i] ] !== undefined ) {
mob_slider.pfx = props[i].replace('Perspective','').toLowerCase();
mob_slider.prop = "-" + mob_slider.pfx + "-transform";
return true;
}
}
return false;
}());
mob_slider.ensureAnimationEnd = '';
// CONTROLSCONTAINER:
if (mob_slider.vars.controlsContainer !== "") mob_slider.controlsContainer = $(mob_slider.vars.controlsContainer).length > 0 && $(mob_slider.vars.controlsContainer);
// MANUAL:
if (mob_slider.vars.manualControls !== "") mob_slider.manualControls = $(mob_slider.vars.manualControls).length > 0 && $(mob_slider.vars.manualControls);
// RANDOMIZE:
if (mob_slider.vars.randomize) {
mob_slider.slides.sort(function() { return (Math.round(Math.random())-0.5); });
mob_slider.container.empty().append(mob_slider.slides);
}
mob_slider.doMath();
// INIT
mob_slider.setup("init");
// CONTROLNAV:
if (mob_slider.vars.controlNav) methods.controlNav.setup();
// DIRECTIONNAV:
if (mob_slider.vars.directionNav) methods.directionNav.setup();
// KEYBOARD:
if (mob_slider.vars.keyboard && ($(mob_slider.containerSelector).length === 1 || mob_slider.vars.multipleKeyboard)) {
$(document).bind('keyup', function(event) {
var keycode = event.keyCode;
if (!mob_slider.animating && (keycode === 39 || keycode === 37)) {
var target = (keycode === 39) ? mob_slider.getTarget('next') :
(keycode === 37) ? mob_slider.getTarget('prev') : false;
mob_slider.flexAnimate(target, mob_slider.vars.pauseOnAction);
}
});
}
// MOUSEWHEEL:
if (mob_slider.vars.mousewheel) {
mob_slider.bind('mousewheel', function(event, delta, deltaX, deltaY) {
event.preventDefault();
var target = (delta < 0) ? mob_slider.getTarget('next') : mob_slider.getTarget('prev');
mob_slider.flexAnimate(target, mob_slider.vars.pauseOnAction);
});
}
// PAUSEPLAY
if (mob_slider.vars.pausePlay) methods.pausePlay.setup();
//PAUSE WHEN INVISIBLE
if (mob_slider.vars.slideshow && mob_slider.vars.pauseInvisible) methods.pauseInvisible.init();
// SLIDSESHOW
if (mob_slider.vars.slideshow) {
if (mob_slider.vars.pauseOnHover) {
mob_slider.hover(function() {
if (!mob_slider.manualPlay && !mob_slider.manualPause) mob_slider.pause();
}, function() {
if (!mob_slider.manualPause && !mob_slider.manualPlay && !mob_slider.stopped) mob_slider.play();
});
}
// initialize animation
//If we're visible, or we don't use PageVisibility API
if(!mob_slider.vars.pauseInvisible || !methods.pauseInvisible.isHidden()) {
(mob_slider.vars.initDelay > 0) ? mob_slider.startTimeout = setTimeout(mob_slider.play, mob_slider.vars.initDelay) : mob_slider.play();
}
}
// ASNAV:
if (asNav) methods.asNav.setup();
// TOUCH
if (touch && mob_slider.vars.touch) methods.touch();
// FADE&&SMOOTHHEIGHT || SLIDE:
if (!fade || (fade && mob_slider.vars.smoothHeight)) $(window).bind("resize orientationchange focus", methods.resize);
mob_slider.find("img").attr("draggable", "false");
// API: start() Callback
setTimeout(function(){
mob_slider.vars.start(mob_slider);
}, 200);
},
asNav: {
setup: function() {
mob_slider.asNav = true;
mob_slider.animatingTo = Math.floor(mob_slider.currentSlide/mob_slider.move);
mob_slider.currentItem = mob_slider.currentSlide;
mob_slider.slides.removeClass(namespace + "active-slide").eq(mob_slider.currentItem).addClass(namespace + "active-slide");
if(!msGesture){
mob_slider.slides.on(eventType, function(e){
e.preventDefault();
var $slide = $(this),
target = $slide.index();
var posFromLeft = $slide.offset().left - $(mob_slider).scrollLeft(); // Find position of slide relative to left of mob_slider container
if( posFromLeft <= 0 && $slide.hasClass( namespace + 'active-slide' ) ) {
mob_slider.flexAnimate(mob_slider.getTarget("prev"), true);
} else if (!$(mob_slider.vars.asNavFor).data('flexslider').animating && !$slide.hasClass(namespace + "active-slide")) {
mob_slider.direction = (mob_slider.currentItem < target) ? "next" : "prev";
mob_slider.flexAnimate(target, mob_slider.vars.pauseOnAction, false, true, true);
}
});
}else{
el._mob_slider = mob_slider;
mob_slider.slides.each(function (){
var that = this;
that._gesture = new MSGesture();
that._gesture.target = that;
that.addEventListener("MSPointerDown", function (e){
e.preventDefault();
if(e.currentTarget._gesture)
e.currentTarget._gesture.addPointer(e.pointerId);
}, false);
that.addEventListener("MSGestureTap", function (e){
e.preventDefault();
var $slide = $(this),
target = $slide.index();
if (!$(mob_slider.vars.asNavFor).data('flexslider').animating && !$slide.hasClass('active')) {
mob_slider.direction = (mob_slider.currentItem < target) ? "next" : "prev";
mob_slider.flexAnimate(target, mob_slider.vars.pauseOnAction, false, true, true);
}
});
});
}
}
},
controlNav: {
setup: function() {
if (!mob_slider.manualControls) {
methods.controlNav.setupPaging();
} else { // MANUALCONTROLS:
methods.controlNav.setupManual();
}
},
setupPaging: function() {
var type = (mob_slider.vars.controlNav === "thumbnails") ? 'control-thumbs' : 'control-paging',
j = 1,
item,
slide;
mob_slider.controlNavScaffold = $('
');
if (mob_slider.pagingCount > 1) {
for (var i = 0; i < mob_slider.pagingCount; i++) {
slide = mob_slider.slides.eq(i);
item = (mob_slider.vars.controlNav === "thumbnails") ? '' : '' + j + '';
if ( 'thumbnails' === mob_slider.vars.controlNav && true === mob_slider.vars.thumbCaptions ) {
var captn = slide.attr( 'data-thumbcaption' );
if ( '' != captn && undefined != captn ) item += '' + captn + '';
}
mob_slider.controlNavScaffold.append('' + item + '');
j++;
}
}
// CONTROLSCONTAINER:
(mob_slider.controlsContainer) ? $(mob_slider.controlsContainer).append(mob_slider.controlNavScaffold) : mob_slider.append(mob_slider.controlNavScaffold);
methods.controlNav.set();
methods.controlNav.active();
mob_slider.controlNavScaffold.delegate('a, img', eventType, function(event) {
event.preventDefault();
if (watchedEvent === "" || watchedEvent === event.type) {
var $this = $(this),
target = mob_slider.controlNav.index($this);
if (!$this.hasClass(namespace + 'active')) {
mob_slider.direction = (target > mob_slider.currentSlide) ? "next" : "prev";
mob_slider.flexAnimate(target, mob_slider.vars.pauseOnAction);
}
}
// setup flags to prevent event duplication
if (watchedEvent === "") {
watchedEvent = event.type;
}
methods.setToClearWatchedEvent();
});
},
setupManual: function() {
mob_slider.controlNav = mob_slider.manualControls;
methods.controlNav.active();
mob_slider.controlNav.bind(eventType, function(event) {
event.preventDefault();
if (watchedEvent === "" || watchedEvent === event.type) {
var $this = $(this),
target = mob_slider.controlNav.index($this);
if (!$this.hasClass(namespace + 'active')) {
(target > mob_slider.currentSlide) ? mob_slider.direction = "next" : mob_slider.direction = "prev";
mob_slider.flexAnimate(target, mob_slider.vars.pauseOnAction);
}
}
// setup flags to prevent event duplication
if (watchedEvent === "") {
watchedEvent = event.type;
}
methods.setToClearWatchedEvent();
});
},
set: function() {
var selector = (mob_slider.vars.controlNav === "thumbnails") ? 'img' : 'a';
mob_slider.controlNav = $('.' + namespace + 'control-nav li ' + selector, (mob_slider.controlsContainer) ? mob_slider.controlsContainer : mob_slider);
},
active: function() {
mob_slider.controlNav.removeClass(namespace + "active").eq(mob_slider.animatingTo).addClass(namespace + "active");
},
update: function(action, pos) {
if (mob_slider.pagingCount > 1 && action === "add") {
mob_slider.controlNavScaffold.append($('' + mob_slider.count + ''));
} else if (mob_slider.pagingCount === 1) {
mob_slider.controlNavScaffold.find('li').remove();
} else {
mob_slider.controlNav.eq(pos).closest('li').remove();
}
methods.controlNav.set();
(mob_slider.pagingCount > 1 && mob_slider.pagingCount !== mob_slider.controlNav.length) ? mob_slider.update(pos, action) : methods.controlNav.active();
}
},
directionNav: {
setup: function() {
var directionNavScaffold = $('');
// CONTROLSCONTAINER:
if (mob_slider.controlsContainer) {
$(mob_slider.controlsContainer).append(directionNavScaffold);
mob_slider.directionNav = $('.' + namespace + 'direction-nav li a', mob_slider.controlsContainer);
} else {
mob_slider.append(directionNavScaffold);
mob_slider.directionNav = $('.' + namespace + 'direction-nav li a', mob_slider);
}
methods.directionNav.update();
mob_slider.directionNav.bind(eventType, function(event) {
event.preventDefault();
var target;
if (watchedEvent === "" || watchedEvent === event.type) {
target = ($(this).hasClass(namespace + 'next')) ? mob_slider.getTarget('next') : mob_slider.getTarget('prev');
mob_slider.flexAnimate(target, mob_slider.vars.pauseOnAction);
}
// setup flags to prevent event duplication
if (watchedEvent === "") {
watchedEvent = event.type;
}
methods.setToClearWatchedEvent();
});
},
update: function() {
var disabledClass = namespace + 'disabled';
if (mob_slider.pagingCount === 1) {
mob_slider.directionNav.addClass(disabledClass).attr('tabindex', '-1');
} else if (!mob_slider.vars.animationLoop) {
if (mob_slider.animatingTo === 0) {
mob_slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "prev").addClass(disabledClass).attr('tabindex', '-1');
} else if (mob_slider.animatingTo === mob_slider.last) {
mob_slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "next").addClass(disabledClass).attr('tabindex', '-1');
} else {
mob_slider.directionNav.removeClass(disabledClass).removeAttr('tabindex');
}
} else {
mob_slider.directionNav.removeClass(disabledClass).removeAttr('tabindex');
}
}
},
pausePlay: {
setup: function() {
var pausePlayScaffold = $('');
// CONTROLSCONTAINER:
if (mob_slider.controlsContainer) {
mob_slider.controlsContainer.append(pausePlayScaffold);
mob_slider.pausePlay = $('.' + namespace + 'pauseplay a', mob_slider.controlsContainer);
} else {
mob_slider.append(pausePlayScaffold);
mob_slider.pausePlay = $('.' + namespace + 'pauseplay a', mob_slider);
}
methods.pausePlay.update((mob_slider.vars.slideshow) ? namespace + 'pause' : namespace + 'play');
mob_slider.pausePlay.bind(eventType, function(event) {
event.preventDefault();
if (watchedEvent === "" || watchedEvent === event.type) {
if ($(this).hasClass(namespace + 'pause')) {
mob_slider.manualPause = true;
mob_slider.manualPlay = false;
mob_slider.pause();
} else {
mob_slider.manualPause = false;
mob_slider.manualPlay = true;
mob_slider.play();
}
}
// setup flags to prevent event duplication
if (watchedEvent === "") {
watchedEvent = event.type;
}
methods.setToClearWatchedEvent();
});
},
update: function(state) {
(state === "play") ? mob_slider.pausePlay.removeClass(namespace + 'pause').addClass(namespace + 'play').html(mob_slider.vars.playText) : mob_slider.pausePlay.removeClass(namespace + 'play').addClass(namespace + 'pause').html(mob_slider.vars.pauseText);
}
},
touch: function() {
var startX,
startY,
offset,
cwidth,
dx,
startT,
scrolling = false,
localX = 0,
localY = 0,
accDx = 0;
if(!msGesture){
el.addEventListener('touchstart', onTouchStart, false);
function onTouchStart(e) {
if (mob_slider.animating) {
e.preventDefault();
} else if ( ( window.navigator.msPointerEnabled ) || e.touches.length === 1 ) {
mob_slider.pause();
// CAROUSEL:
cwidth = (vertical) ? mob_slider.h : mob_slider. w;
startT = Number(new Date());
// CAROUSEL:
// Local vars for X and Y points.
localX = e.touches[0].pageX;
localY = e.touches[0].pageY;
offset = (carousel && reverse && mob_slider.animatingTo === mob_slider.last) ? 0 :
(carousel && reverse) ? mob_slider.limit - (((mob_slider.itemW + mob_slider.vars.itemMargin) * mob_slider.move) * mob_slider.animatingTo) :
(carousel && mob_slider.currentSlide === mob_slider.last) ? mob_slider.limit :
(carousel) ? ((mob_slider.itemW + mob_slider.vars.itemMargin) * mob_slider.move) * mob_slider.currentSlide :
(reverse) ? (mob_slider.last - mob_slider.currentSlide + mob_slider.cloneOffset) * cwidth : (mob_slider.currentSlide + mob_slider.cloneOffset) * cwidth;
startX = (vertical) ? localY : localX;
startY = (vertical) ? localX : localY;
el.addEventListener('touchmove', onTouchMove, false);
el.addEventListener('touchend', onTouchEnd, false);
}
}
function onTouchMove(e) {
// Local vars for X and Y points.
localX = e.touches[0].pageX;
localY = e.touches[0].pageY;
dx = (vertical) ? startX - localY : startX - localX;
scrolling = (vertical) ? (Math.abs(dx) < Math.abs(localX - startY)) : (Math.abs(dx) < Math.abs(localY - startY));
var fxms = 500;
if ( ! scrolling || Number( new Date() ) - startT > fxms ) {
e.preventDefault();
if (!fade && mob_slider.transitions) {
if (!mob_slider.vars.animationLoop) {
dx = dx/((mob_slider.currentSlide === 0 && dx < 0 || mob_slider.currentSlide === mob_slider.last && dx > 0) ? (Math.abs(dx)/cwidth+2) : 1);
}
mob_slider.setProps(offset + dx, "setTouch");
}
}
}
function onTouchEnd(e) {
// finish the touch by undoing the touch session
el.removeEventListener('touchmove', onTouchMove, false);
if (mob_slider.animatingTo === mob_slider.currentSlide && !scrolling && !(dx === null)) {
var updateDx = (reverse) ? -dx : dx,
target = (updateDx > 0) ? mob_slider.getTarget('next') : mob_slider.getTarget('prev');
if (mob_slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth/2)) {
mob_slider.flexAnimate(target, mob_slider.vars.pauseOnAction);
} else {
if (!fade) mob_slider.flexAnimate(mob_slider.currentSlide, mob_slider.vars.pauseOnAction, true);
}
}
el.removeEventListener('touchend', onTouchEnd, false);
startX = null;
startY = null;
dx = null;
offset = null;
}
}else{
el.style.msTouchAction = "none";
el._gesture = new MSGesture();
el._gesture.target = el;
el.addEventListener("MSPointerDown", onMSPointerDown, false);
el._mob_slider = mob_slider;
el.addEventListener("MSGestureChange", onMSGestureChange, false);
el.addEventListener("MSGestureEnd", onMSGestureEnd, false);
function onMSPointerDown(e){
e.stopPropagation();
if (mob_slider.animating) {
e.preventDefault();
}else{
mob_slider.pause();
el._gesture.addPointer(e.pointerId);
accDx = 0;
cwidth = (vertical) ? mob_slider.h : mob_slider. w;
startT = Number(new Date());
// CAROUSEL:
offset = (carousel && reverse && mob_slider.animatingTo === mob_slider.last) ? 0 :
(carousel && reverse) ? mob_slider.limit - (((mob_slider.itemW + mob_slider.vars.itemMargin) * mob_slider.move) * mob_slider.animatingTo) :
(carousel && mob_slider.currentSlide === mob_slider.last) ? mob_slider.limit :
(carousel) ? ((mob_slider.itemW + mob_slider.vars.itemMargin) * mob_slider.move) * mob_slider.currentSlide :
(reverse) ? (mob_slider.last - mob_slider.currentSlide + mob_slider.cloneOffset) * cwidth : (mob_slider.currentSlide + mob_slider.cloneOffset) * cwidth;
}
}
function onMSGestureChange(e) {
e.stopPropagation();
var mob_slider = e.target._mob_slider;
if(!mob_slider){
return;
}
var transX = -e.translationX,
transY = -e.translationY;
//Accumulate translations.
accDx = accDx + ((vertical) ? transY : transX);
dx = accDx;
scrolling = (vertical) ? (Math.abs(accDx) < Math.abs(-transX)) : (Math.abs(accDx) < Math.abs(-transY));
if(e.detail === e.MSGESTURE_FLAG_INERTIA){
setImmediate(function (){
el._gesture.stop();
});
return;
}
if (!scrolling || Number(new Date()) - startT > 500) {
e.preventDefault();
if (!fade && mob_slider.transitions) {
if (!mob_slider.vars.animationLoop) {
dx = accDx / ((mob_slider.currentSlide === 0 && accDx < 0 || mob_slider.currentSlide === mob_slider.last && accDx > 0) ? (Math.abs(accDx) / cwidth + 2) : 1);
}
mob_slider.setProps(offset + dx, "setTouch");
}
}
}
function onMSGestureEnd(e) {
e.stopPropagation();
var mob_slider = e.target._mob_slider;
if(!mob_slider){
return;
}
if (mob_slider.animatingTo === mob_slider.currentSlide && !scrolling && !(dx === null)) {
var updateDx = (reverse) ? -dx : dx,
target = (updateDx > 0) ? mob_slider.getTarget('next') : mob_slider.getTarget('prev');
if (mob_slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 50 || Math.abs(updateDx) > cwidth/2)) {
mob_slider.flexAnimate(target, mob_slider.vars.pauseOnAction);
} else {
if (!fade) mob_slider.flexAnimate(mob_slider.currentSlide, mob_slider.vars.pauseOnAction, true);
}
}
startX = null;
startY = null;
dx = null;
offset = null;
accDx = 0;
}
}
},
resize: function() {
if (!mob_slider.animating && mob_slider.is(':visible')) {
if (!carousel) mob_slider.doMath();
if (fade) {
// SMOOTH HEIGHT:
methods.smoothHeight();
} else if (carousel) { //CAROUSEL:
mob_slider.slides.width(mob_slider.computedW);
mob_slider.update(mob_slider.pagingCount);
mob_slider.setProps();
}
else if (vertical) { //VERTICAL:
mob_slider.viewport.height(mob_slider.h);
mob_slider.setProps(mob_slider.h, "setTotal");
} else {
// SMOOTH HEIGHT:
if (mob_slider.vars.smoothHeight) methods.smoothHeight();
mob_slider.newSlides.width(mob_slider.computedW);
mob_slider.setProps(mob_slider.computedW, "setTotal");
}
}
},
smoothHeight: function(dur) {
if (!vertical || fade) {
var $obj = (fade) ? mob_slider : mob_slider.viewport;
(dur) ? $obj.animate({"height": mob_slider.slides.eq(mob_slider.animatingTo).height()}, dur) : $obj.height(mob_slider.slides.eq(mob_slider.animatingTo).height());
}
},
sync: function(action) {
var $obj = $(mob_slider.vars.sync).data("flexmob_slider"),
target = mob_slider.animatingTo;
switch (action) {
case "animate": $obj.flexAnimate(target, mob_slider.vars.pauseOnAction, false, true); break;
case "play": if (!$obj.playing && !$obj.asNav) { $obj.play(); } break;
case "pause": $obj.pause(); break;
}
},
uniqueID: function($clone) {
$clone.find( '[id]' ).each(function() {
var $this = $(this);
$this.attr( 'id', $this.attr( 'id' ) + '_clone' );
});
return $clone;
},
pauseInvisible: {
visProp: null,
init: function() {
var prefixes = ['webkit','moz','ms','o'];
if ('hidden' in document) return 'hidden';
for (var i = 0; i < prefixes.length; i++) {
if ((prefixes[i] + 'Hidden') in document)
methods.pauseInvisible.visProp = prefixes[i] + 'Hidden';
}
if (methods.pauseInvisible.visProp) {
var evtname = methods.pauseInvisible.visProp.replace(/[H|h]idden/,'') + 'visibilitychange';
document.addEventListener(evtname, function() {
if (methods.pauseInvisible.isHidden()) {
if(mob_slider.startTimeout) clearTimeout(mob_slider.startTimeout); //If clock is ticking, stop timer and prevent from starting while invisible
else mob_slider.pause(); //Or just pause
}
else {
if(mob_slider.started) mob_slider.play(); //Initiated before, just play
else (mob_slider.vars.initDelay > 0) ? setTimeout(mob_slider.play, mob_slider.vars.initDelay) : mob_slider.play(); //Didn't init before: simply init or wait for it
}
});
}
},
isHidden: function() {
return document[methods.pauseInvisible.visProp] || false;
}
},
setToClearWatchedEvent: function() {
clearTimeout(watchedEventClearTimer);
watchedEventClearTimer = setTimeout(function() {
watchedEvent = "";
}, 3000);
}
};
// public methods
mob_slider.flexAnimate = function(target, pause, override, withSync, fromNav) {
if (!mob_slider.vars.animationLoop && target !== mob_slider.currentSlide) {
mob_slider.direction = (target > mob_slider.currentSlide) ? "next" : "prev";
}
if (asNav && mob_slider.pagingCount === 1) mob_slider.direction = (mob_slider.currentItem < target) ? "next" : "prev";
if (!mob_slider.animating && (mob_slider.canAdvance(target, fromNav) || override) && mob_slider.is(":visible")) {
if (asNav && withSync) {
var master = $(mob_slider.vars.asNavFor).data('flexmob_slider');
mob_slider.atEnd = target === 0 || target === mob_slider.count - 1;
master.flexAnimate(target, true, false, true, fromNav);
mob_slider.direction = (mob_slider.currentItem < target) ? "next" : "prev";
master.direction = mob_slider.direction;
if (Math.ceil((target + 1)/mob_slider.visible) - 1 !== mob_slider.currentSlide && target !== 0) {
mob_slider.currentItem = target;
mob_slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
target = Math.floor(target/mob_slider.visible);
} else {
mob_slider.currentItem = target;
mob_slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
return false;
}
}
mob_slider.animating = true;
mob_slider.animatingTo = target;
// SLIDESHOW:
if (pause) mob_slider.pause();
// API: before() animation Callback
mob_slider.vars.before(mob_slider);
// SYNC:
if (mob_slider.syncExists && !fromNav) methods.sync("animate");
// CONTROLNAV
if (mob_slider.vars.controlNav) methods.controlNav.active();
// !CAROUSEL:
// CANDIDATE: slide active class (for add/remove slide)
if (!carousel) mob_slider.slides.removeClass(namespace + 'active-slide').eq(target).addClass(namespace + 'active-slide');
// INFINITE LOOP:
// CANDIDATE: atEnd
mob_slider.atEnd = target === 0 || target === mob_slider.last;
// DIRECTIONNAV:
if (mob_slider.vars.directionNav) methods.directionNav.update();
if (target === mob_slider.last) {
// API: end() of cycle Callback
mob_slider.vars.end(mob_slider);
// SLIDESHOW && !INFINITE LOOP:
if (!mob_slider.vars.animationLoop) mob_slider.pause();
}
// SLIDE:
if (!fade) {
var dimension = (vertical) ? mob_slider.slides.filter(':first').height() : mob_slider.computedW,
margin, slideString, calcNext;
// INFINITE LOOP / REVERSE:
if (carousel) {
//margin = (mob_slider.vars.itemWidth > mob_slider.w) ? mob_slider.vars.itemMargin * 2 : mob_slider.vars.itemMargin;
margin = mob_slider.vars.itemMargin;
calcNext = ((mob_slider.itemW + margin) * mob_slider.move) * mob_slider.animatingTo;
slideString = (calcNext > mob_slider.limit && mob_slider.visible !== 1) ? mob_slider.limit : calcNext;
} else if (mob_slider.currentSlide === 0 && target === mob_slider.count - 1 && mob_slider.vars.animationLoop && mob_slider.direction !== "next") {
slideString = (reverse) ? (mob_slider.count + mob_slider.cloneOffset) * dimension : 0;
} else if (mob_slider.currentSlide === mob_slider.last && target === 0 && mob_slider.vars.animationLoop && mob_slider.direction !== "prev") {
slideString = (reverse) ? 0 : (mob_slider.count + 1) * dimension;
} else {
slideString = (reverse) ? ((mob_slider.count - 1) - target + mob_slider.cloneOffset) * dimension : (target + mob_slider.cloneOffset) * dimension;
}
mob_slider.setProps(slideString, "", mob_slider.vars.animationSpeed);
if (mob_slider.transitions) {
if (!mob_slider.vars.animationLoop || !mob_slider.atEnd) {
mob_slider.animating = false;
mob_slider.currentSlide = mob_slider.animatingTo;
}
// Unbind previous transitionEnd events and re-bind new transitionEnd event
mob_slider.container.unbind("webkitTransitionEnd transitionend");
mob_slider.container.bind("webkitTransitionEnd transitionend", function() {
clearTimeout(mob_slider.ensureAnimationEnd);
mob_slider.wrapup(dimension);
});
// Insurance for the ever-so-fickle transitionEnd event
clearTimeout(mob_slider.ensureAnimationEnd);
mob_slider.ensureAnimationEnd = setTimeout(function() {
mob_slider.wrapup(dimension);
}, mob_slider.vars.animationSpeed + 100);
} else {
mob_slider.container.animate(mob_slider.args, mob_slider.vars.animationSpeed, mob_slider.vars.easing, function(){
mob_slider.wrapup(dimension);
});
}
} else { // FADE:
if (!touch) {
//mob_slider.slides.eq(mob_slider.currentSlide).fadeOut(mob_slider.vars.animationSpeed, mob_slider.vars.easing);
//mob_slider.slides.eq(target).fadeIn(mob_slider.vars.animationSpeed, mob_slider.vars.easing, mob_slider.wrapup);
mob_slider.slides.eq(mob_slider.currentSlide).css({"zIndex": 1}).animate({"opacity": 0}, mob_slider.vars.animationSpeed, mob_slider.vars.easing);
mob_slider.slides.eq(target).css({"zIndex": 2}).animate({"opacity": 1}, mob_slider.vars.animationSpeed, mob_slider.vars.easing, mob_slider.wrapup);
} else {
mob_slider.slides.eq(mob_slider.currentSlide).css({ "opacity": 0, "zIndex": 1 });
mob_slider.slides.eq(target).css({ "opacity": 1, "zIndex": 2 });
mob_slider.wrapup(dimension);
}
}
// SMOOTH HEIGHT:
if (mob_slider.vars.smoothHeight) methods.smoothHeight(mob_slider.vars.animationSpeed);
}
};
mob_slider.wrapup = function(dimension) {
// SLIDE:
if (!fade && !carousel) {
if (mob_slider.currentSlide === 0 && mob_slider.animatingTo === mob_slider.last && mob_slider.vars.animationLoop) {
mob_slider.setProps(dimension, "jumpEnd");
} else if (mob_slider.currentSlide === mob_slider.last && mob_slider.animatingTo === 0 && mob_slider.vars.animationLoop) {
mob_slider.setProps(dimension, "jumpStart");
}
}
mob_slider.animating = false;
mob_slider.currentSlide = mob_slider.animatingTo;
// API: after() animation Callback
mob_slider.vars.after(mob_slider);
};
// SLIDESHOW:
mob_slider.animateSlides = function() {
if (!mob_slider.animating && focused ) mob_slider.flexAnimate(mob_slider.getTarget("next"));
};
// SLIDESHOW:
mob_slider.pause = function() {
clearInterval(mob_slider.animatedSlides);
mob_slider.animatedSlides = null;
mob_slider.playing = false;
// PAUSEPLAY:
if (mob_slider.vars.pausePlay) methods.pausePlay.update("play");
// SYNC:
if (mob_slider.syncExists) methods.sync("pause");
};
// SLIDESHOW:
mob_slider.play = function() {
if (mob_slider.playing) clearInterval(mob_slider.animatedSlides);
mob_slider.animatedSlides = mob_slider.animatedSlides || setInterval(mob_slider.animateSlides, mob_slider.vars.slideshowSpeed);
mob_slider.started = mob_slider.playing = true;
// PAUSEPLAY:
if (mob_slider.vars.pausePlay) methods.pausePlay.update("pause");
// SYNC:
if (mob_slider.syncExists) methods.sync("play");
};
// STOP:
mob_slider.stop = function () {
mob_slider.pause();
mob_slider.stopped = true;
};
mob_slider.canAdvance = function(target, fromNav) {
// ASNAV:
var last = (asNav) ? mob_slider.pagingCount - 1 : mob_slider.last;
return (fromNav) ? true :
(asNav && mob_slider.currentItem === mob_slider.count - 1 && target === 0 && mob_slider.direction === "prev") ? true :
(asNav && mob_slider.currentItem === 0 && target === mob_slider.pagingCount - 1 && mob_slider.direction !== "next") ? false :
(target === mob_slider.currentSlide && !asNav) ? false :
(mob_slider.vars.animationLoop) ? true :
(mob_slider.atEnd && mob_slider.currentSlide === 0 && target === last && mob_slider.direction !== "next") ? false :
(mob_slider.atEnd && mob_slider.currentSlide === last && target === 0 && mob_slider.direction === "next") ? false :
true;
};
mob_slider.getTarget = function(dir) {
mob_slider.direction = dir;
if (dir === "next") {
return (mob_slider.currentSlide === mob_slider.last) ? 0 : mob_slider.currentSlide + 1;
} else {
return (mob_slider.currentSlide === 0) ? mob_slider.last : mob_slider.currentSlide - 1;
}
};
// SLIDE:
mob_slider.setProps = function(pos, special, dur) {
var target = (function() {
var posCheck = (pos) ? pos : ((mob_slider.itemW + mob_slider.vars.itemMargin) * mob_slider.move) * mob_slider.animatingTo,
posCalc = (function() {
if (carousel) {
return (special === "setTouch") ? pos :
(reverse && mob_slider.animatingTo === mob_slider.last) ? 0 :
(reverse) ? mob_slider.limit - (((mob_slider.itemW + mob_slider.vars.itemMargin) * mob_slider.move) * mob_slider.animatingTo) :
(mob_slider.animatingTo === mob_slider.last) ? mob_slider.limit : posCheck;
} else {
switch (special) {
case "setTotal": return (reverse) ? ((mob_slider.count - 1) - mob_slider.currentSlide + mob_slider.cloneOffset) * pos : (mob_slider.currentSlide + mob_slider.cloneOffset) * pos;
case "setTouch": return (reverse) ? pos : pos;
case "jumpEnd": return (reverse) ? pos : mob_slider.count * pos;
case "jumpStart": return (reverse) ? mob_slider.count * pos : pos;
default: return pos;
}
}
}());
return (posCalc * -1) + "px";
}());
if (mob_slider.transitions) {
target = (vertical) ? "translate3d(0," + target + ",0)" : "translate3d(" + target + ",0,0)";
dur = (dur !== undefined) ? (dur/1000) + "s" : "0s";
mob_slider.container.css("-" + mob_slider.pfx + "-transition-duration", dur);
mob_slider.container.css("transition-duration", dur);
}
mob_slider.args[mob_slider.prop] = target;
if (mob_slider.transitions || dur === undefined) mob_slider.container.css(mob_slider.args);
mob_slider.container.css('transform',target);
};
mob_slider.setup = function(type) {
// SLIDE:
if (!fade) {
var mob_sliderOffset, arr;
if (type === "init") {
mob_slider.viewport = $('').css({"overflow": "hidden", "position": "relative"}).appendTo(mob_slider).append(mob_slider.container);
// INFINITE LOOP:
mob_slider.cloneCount = 0;
mob_slider.cloneOffset = 0;
// REVERSE:
if (reverse) {
arr = $.makeArray(mob_slider.slides).reverse();
mob_slider.slides = $(arr);
mob_slider.container.empty().append(mob_slider.slides);
}
}
// INFINITE LOOP && !CAROUSEL:
if (mob_slider.vars.animationLoop && !carousel) {
mob_slider.cloneCount = 2;
mob_slider.cloneOffset = 1;
// clear out old clones
if (type !== "init") mob_slider.container.find('.clone').remove();
// mob_slider.container.append(mob_slider.slides.first().clone().addClass('clone').attr('aria-hidden', 'true')).prepend(mob_slider.slides.last().clone().addClass('clone').attr('aria-hidden', 'true'));
methods.uniqueID( mob_slider.slides.first().clone().addClass('clone').attr('aria-hidden', 'true') ).appendTo( mob_slider.container );
methods.uniqueID( mob_slider.slides.last().clone().addClass('clone').attr('aria-hidden', 'true') ).prependTo( mob_slider.container );
}
mob_slider.newSlides = $(mob_slider.vars.selector, mob_slider);
mob_sliderOffset = (reverse) ? mob_slider.count - 1 - mob_slider.currentSlide + mob_slider.cloneOffset : mob_slider.currentSlide + mob_slider.cloneOffset;
// VERTICAL:
if (vertical && !carousel) {
mob_slider.container.height((mob_slider.count + mob_slider.cloneCount) * 200 + "%").css("position", "absolute").width("100%");
setTimeout(function(){
mob_slider.newSlides.css({"display": "block"});
mob_slider.doMath();
mob_slider.viewport.height(mob_slider.h);
mob_slider.setProps(mob_sliderOffset * mob_slider.h, "init");
}, (type === "init") ? 100 : 0);
} else {
mob_slider.container.width((mob_slider.count + mob_slider.cloneCount) * 200 + "%");
mob_slider.setProps(mob_sliderOffset * mob_slider.computedW, "init");
setTimeout(function(){
mob_slider.doMath();
mob_slider.newSlides.css({"width": mob_slider.computedW, "float": "left", "display": "block"});
// SMOOTH HEIGHT:
if (mob_slider.vars.smoothHeight) methods.smoothHeight();
}, (type === "init") ? 100 : 0);
}
} else { // FADE:
mob_slider.slides.css({"width": "100%", "float": "left", "marginRight": "-100%", "position": "relative"});
if (type === "init") {
if (!touch) {
//mob_slider.slides.eq(mob_slider.currentSlide).fadeIn(mob_slider.vars.animationSpeed, mob_slider.vars.easing);
mob_slider.slides.css({ "opacity": 0, "display": "block", "zIndex": 1 }).eq(mob_slider.currentSlide).css({"zIndex": 2}).animate({"opacity": 1},mob_slider.vars.animationSpeed,mob_slider.vars.easing);
} else {
mob_slider.slides.css({ "opacity": 0, "display": "block", "webkitTransition": "opacity " + mob_slider.vars.animationSpeed / 1000 + "s ease", "zIndex": 1 }).eq(mob_slider.currentSlide).css({ "opacity": 1, "zIndex": 2});
}
}
// SMOOTH HEIGHT:
if (mob_slider.vars.smoothHeight) methods.smoothHeight();
}
// !CAROUSEL:
// CANDIDATE: active slide
if (!carousel) mob_slider.slides.removeClass(namespace + "active-slide").eq(mob_slider.currentSlide).addClass(namespace + "active-slide");
//Flexmob_slider: init() Callback
mob_slider.vars.init(mob_slider);
};
mob_slider.doMath = function() {
var slide = mob_slider.slides.first(),
slideMargin = mob_slider.vars.itemMargin,
minItems = mob_slider.vars.minItems,
maxItems = mob_slider.vars.maxItems;
mob_slider.w = (mob_slider.viewport===undefined) ? mob_slider.width() : mob_slider.viewport.width();
mob_slider.h = slide.height();
mob_slider.boxPadding = slide.outerWidth() - slide.width();
// CAROUSEL:
if (carousel) {
mob_slider.itemT = mob_slider.vars.itemWidth + slideMargin;
mob_slider.minW = (minItems) ? minItems * mob_slider.itemT : mob_slider.w;
mob_slider.maxW = (maxItems) ? (maxItems * mob_slider.itemT) - slideMargin : mob_slider.w;
mob_slider.itemW = (mob_slider.minW > mob_slider.w) ? (mob_slider.w - (slideMargin * (minItems - 1)))/minItems :
(mob_slider.maxW < mob_slider.w) ? (mob_slider.w - (slideMargin * (maxItems - 1)))/maxItems :
(mob_slider.vars.itemWidth > mob_slider.w) ? mob_slider.w : mob_slider.vars.itemWidth;
mob_slider.visible = Math.floor(mob_slider.w/(mob_slider.itemW));
mob_slider.move = (mob_slider.vars.move > 0 && mob_slider.vars.move < mob_slider.visible ) ? mob_slider.vars.move : mob_slider.visible;
mob_slider.pagingCount = Math.ceil(((mob_slider.count - mob_slider.visible)/mob_slider.move) + 1);
mob_slider.last = mob_slider.pagingCount - 1;
mob_slider.limit = (mob_slider.pagingCount === 1) ? 0 :
(mob_slider.vars.itemWidth > mob_slider.w) ? (mob_slider.itemW * (mob_slider.count - 1)) + (slideMargin * (mob_slider.count - 1)) : ((mob_slider.itemW + slideMargin) * mob_slider.count) - mob_slider.w - slideMargin;
} else {
mob_slider.itemW = mob_slider.w;
mob_slider.pagingCount = mob_slider.count;
mob_slider.last = mob_slider.count - 1;
}
mob_slider.computedW = mob_slider.itemW - mob_slider.boxPadding;
};
mob_slider.update = function(pos, action) {
mob_slider.doMath();
// update currentSlide and mob_slider.animatingTo if necessary
if (!carousel) {
if (pos < mob_slider.currentSlide) {
mob_slider.currentSlide += 1;
} else if (pos <= mob_slider.currentSlide && pos !== 0) {
mob_slider.currentSlide -= 1;
}
mob_slider.animatingTo = mob_slider.currentSlide;
}
// update controlNav
if (mob_slider.vars.controlNav && !mob_slider.manualControls) {
if ((action === "add" && !carousel) || mob_slider.pagingCount > mob_slider.controlNav.length) {
methods.controlNav.update("add");
} else if ((action === "remove" && !carousel) || mob_slider.pagingCount < mob_slider.controlNav.length) {
if (carousel && mob_slider.currentSlide > mob_slider.last) {
mob_slider.currentSlide -= 1;
mob_slider.animatingTo -= 1;
}
methods.controlNav.update("remove", mob_slider.last);
}
}
// update directionNav
if (mob_slider.vars.directionNav) methods.directionNav.update();
};
mob_slider.addSlide = function(obj, pos) {
var $obj = $(obj);
mob_slider.count += 1;
mob_slider.last = mob_slider.count - 1;
// append new slide
if (vertical && reverse) {
(pos !== undefined) ? mob_slider.slides.eq(mob_slider.count - pos).after($obj) : mob_slider.container.prepend($obj);
} else {
(pos !== undefined) ? mob_slider.slides.eq(pos).before($obj) : mob_slider.container.append($obj);
}
// update currentSlide, animatingTo, controlNav, and directionNav
mob_slider.update(pos, "add");
// update mob_slider.slides
mob_slider.slides = $(mob_slider.vars.selector + ':not(.clone)', mob_slider);
// re-setup the mob_slider to accomdate new slide
mob_slider.setup();
//Flexmob_slider: added() Callback
mob_slider.vars.added(mob_slider);
};
mob_slider.removeSlide = function(obj) {
var pos = (isNaN(obj)) ? mob_slider.slides.index($(obj)) : obj;
// update count
mob_slider.count -= 1;
mob_slider.last = mob_slider.count - 1;
// remove slide
if (isNaN(obj)) {
$(obj, mob_slider.slides).remove();
} else {
(vertical && reverse) ? mob_slider.slides.eq(mob_slider.last).remove() : mob_slider.slides.eq(obj).remove();
}
// update currentSlide, animatingTo, controlNav, and directionNav
mob_slider.doMath();
mob_slider.update(pos, "remove");
// update mob_slider.slides
mob_slider.slides = $(mob_slider.vars.selector + ':not(.clone)', mob_slider);
// re-setup the mob_slider to accomdate new slide
mob_slider.setup();
// Flexmob_slider: removed() Callback
mob_slider.vars.removed(mob_slider);
};
//FlexSlider: Initialize
methods.init();
};
// Ensure the slider isn't focussed if the window loses focus.
$( window ).blur( function ( e ) {
focused = false;
}).focus( function ( e ) {
focused = true;
});
//FlexSlider: Default Settings
$.flexslider.defaults = {
namespace: "flex-", //{NEW} String: Prefix string attached to the class of every element generated by the plugin
selector: ".slides > li", //{NEW} Selector: Must match a simple pattern. '{container} > {slide}' -- Ignore pattern at your own peril
animation: "fade", //String: Select your animation type, "fade" or "slide"
easing: "swing", //{NEW} String: Determines the easing method used in jQuery transitions. jQuery easing plugin is supported!
direction: "horizontal", //String: Select the sliding direction, "horizontal" or "vertical"
reverse: false, //{NEW} Boolean: Reverse the animation direction
animationLoop: true, //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end
smoothHeight: false, //{NEW} Boolean: Allow height of the slider to animate smoothly in horizontal mode
startAt: 0, //Integer: The slide that the slider should start on. Array notation (0 = first slide)
slideshow: true, //Boolean: Animate slider automatically
slideshowSpeed: 7000, //Integer: Set the speed of the slideshow cycling, in milliseconds
animationSpeed: 600, //Integer: Set the speed of animations, in milliseconds
initDelay: 0, //{NEW} Integer: Set an initialization delay, in milliseconds
randomize: false, //Boolean: Randomize slide order
thumbCaptions: false, //Boolean: Whether or not to put captions on thumbnails when using the "thumbnails" controlNav.
// Usability features
pauseOnAction: true, //Boolean: Pause the slideshow when interacting with control elements, highly recommended.
pauseOnHover: false, //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering
pauseInvisible: true, //{NEW} Boolean: Pause the slideshow when tab is invisible, resume when visible. Provides better UX, lower CPU usage.
useCSS: true, //{NEW} Boolean: Slider will use CSS3 transitions if available
touch: true, //{NEW} Boolean: Allow touch swipe navigation of the slider on touch-enabled devices
video: false, //{NEW} Boolean: If using video in the slider, will prevent CSS3 3D Transforms to avoid graphical glitches
// Primary Controls
controlNav: true, //Boolean: Create navigation for paging control of each clide? Note: Leave true for manualControls usage
directionNav: true, //Boolean: Create navigation for previous/next navigation? (true/false)
prevText: "Previous", //String: Set the text for the "previous" directionNav item
nextText: "Next", //String: Set the text for the "next" directionNav item
// Secondary Navigation
keyboard: true, //Boolean: Allow slider navigating via keyboard left/right keys
multipleKeyboard: false, //{NEW} Boolean: Allow keyboard navigation to affect multiple sliders. Default behavior cuts out keyboard navigation with more than one slider present.
mousewheel: false, //{UPDATED} Boolean: Requires jquery.mousewheel.js (https://github.com/brandonaaron/jquery-mousewheel) - Allows slider navigating via mousewheel
pausePlay: false, //Boolean: Create pause/play dynamic element
pauseText: "Pause", //String: Set the text for the "pause" pausePlay item
playText: "Play", //String: Set the text for the "play" pausePlay item
// Special properties
controlsContainer: "", //{UPDATED} jQuery Object/Selector: Declare which container the navigation elements should be appended too. Default container is the FlexSlider element. Example use would be $(".flexslider-container"). Property is ignored if given element is not found.
manualControls: "", //{UPDATED} jQuery Object/Selector: Declare custom control navigation. Examples would be $(".flex-control-nav li") or "#tabs-nav li img", etc. The number of elements in your controlNav should match the number of slides/tabs.
sync: "", //{NEW} Selector: Mirror the actions performed on this slider with another slider. Use with care.
asNavFor: "", //{NEW} Selector: Internal property exposed for turning the slider into a thumbnail navigation for another slider
// Carousel Options
itemWidth: 0, //{NEW} Integer: Box-model width of individual carousel items, including horizontal borders and padding.
itemMargin: 0, //{NEW} Integer: Margin between carousel items.
minItems: 1, //{NEW} Integer: Minimum number of carousel items that should be visible. Items will resize fluidly when below this.
maxItems: 0, //{NEW} Integer: Maxmimum number of carousel items that should be visible. Items will resize fluidly when above this limit.
move: 0, //{NEW} Integer: Number of carousel items that should move on animation. If 0, slider will move all visible items.
allowOneSlide: true, //{NEW} Boolean: Whether or not to allow a slider comprised of a single slide
// Callback API
start: function(){}, //Callback: function(slider) - Fires when the slider loads the first slide
before: function(){}, //Callback: function(slider) - Fires asynchronously with each slider animation
after: function(){}, //Callback: function(slider) - Fires after each slider animation completes
end: function(){}, //Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous)
added: function(){}, //{NEW} Callback: function(slider) - Fires after a slide is added
removed: function(){}, //{NEW} Callback: function(slider) - Fires after a slide is removed
init: function() {} //{NEW} Callback: function(slider) - Fires after the slider is initially setup
};
//FlexSlider: Plugin Function
$.fn.flexslider = function(options) {
if (options === undefined) options = {};
if (typeof options === "object") {
return this.each(function() {
var $this = $(this),
selector = (options.selector) ? options.selector : ".slides > li",
$slides = $this.find(selector);
if ( ( $slides.length === 1 && options.allowOneSlide === true ) || $slides.length === 0 ) {
$slides.fadeIn(400);
if (options.start) options.start($this);
} else if ($this.data('flexslider') === undefined) {
new $.flexslider(this, options);
}
});
} else {
// Helper strings to quickly perform functions on the slider
var $mob_slider = $(this).data('flexslider');
switch (options) {
case "play": $mob_slider.play(); break;
case "pause": $mob_slider.pause(); break;
case "stop": $mob_slider.stop(); break;
case "next": $mob_slider.flexAnimate($mob_slider.getTarget("next"), true); break;
case "prev":
case "previous": $mob_slider.flexAnimate($mob_slider.getTarget("prev"), true); break;
default: if (typeof options === "number") $mob_slider.flexAnimate(options, true);
}
}
};
})(jQuery);