RishiShreshtha

jquery.flexslider-min.js

Mar 19th, 2013
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 22.82 KB | None | 0 0
  1. /* jquery.flexslider-min.js
  2.  * jQuery FlexSlider v2.1
  3.  * Copyright 2012 WooThemes
  4.  * Contributing Author: Tyler Smith
  5.  */
  6. ;
  7. (function (d) {
  8.   d.flexslider = function (i, k) {
  9.     var a = d(i),
  10.       c = d.extend({}, d.flexslider.defaults, k),
  11.       e = c.namespace,
  12.       p = "ontouchstart" in window || window.DocumentTouch && document instanceof DocumentTouch,
  13.       t = p ? "touchend" : "click",
  14.       l = "vertical" === c.direction,
  15.       m = c.reverse,
  16.       h = 0 < c.itemWidth,
  17.       r = "fade" === c.animation,
  18.       s = "" !== c.asNavFor,
  19.       f = {};
  20.     d.data(i, "flexslider", a);
  21.     f = {
  22.       init: function () {
  23.         a.animating = !1;
  24.         a.currentSlide = c.startAt;
  25.         a.animatingTo = a.currentSlide;
  26.         a.atEnd = 0 === a.currentSlide || a.currentSlide === a.last;
  27.         a.containerSelector = c.selector.substr(0, c.selector.search(" "));
  28.         a.slides = d(c.selector, a);
  29.         a.container = d(a.containerSelector, a);
  30.         a.count = a.slides.length;
  31.         a.syncExists = 0 < d(c.sync).length;
  32.         "slide" === c.animation && (c.animation = "swing");
  33.         a.prop = l ? "top" : "marginLeft";
  34.         a.args = {};
  35.         a.manualPause = !1;
  36.         var b = a,
  37.           g;
  38.         if (g = !c.video) if (g = !r) if (g = c.useCSS) a: {
  39.           g = document.createElement("div");
  40.           var n = ["perspectiveProperty", "WebkitPerspective", "MozPerspective", "OPerspective", "msPerspective"],
  41.             e;
  42.           for (e in n) if (void 0 !== g.style[n[e]]) {
  43.             a.pfx = n[e].replace("Perspective", "").toLowerCase();
  44.             a.prop = "-" + a.pfx + "-transform";
  45.             g = !0;
  46.             break a
  47.           }
  48.           g = !1
  49.         }
  50.         b.transitions = g;
  51.         "" !== c.controlsContainer && (a.controlsContainer = 0 < d(c.controlsContainer).length && d(c.controlsContainer));
  52.         "" !== c.manualControls && (a.manualControls = 0 < d(c.manualControls).length && d(c.manualControls));
  53.         c.randomize && (a.slides.sort(function () {
  54.           return Math.round(Math.random()) - 0.5
  55.         }), a.container.empty().append(a.slides));
  56.         a.doMath();
  57.         s && f.asNav.setup();
  58.         a.setup("init");
  59.         c.controlNav && f.controlNav.setup();
  60.         c.directionNav && f.directionNav.setup();
  61.         c.keyboard && (1 === d(a.containerSelector).length || c.multipleKeyboard) && d(document).bind("keyup", function (b) {
  62.           b = b.keyCode;
  63.           if (!a.animating && (39 === b || 37 === b)) b = 39 === b ? a.getTarget("next") : 37 === b ? a.getTarget("prev") : !1, a.flexAnimate(b, c.pauseOnAction)
  64.         });
  65.         c.mousewheel && a.bind("mousewheel", function (b, g) {
  66.           b.preventDefault();
  67.           var d = 0 > g ? a.getTarget("next") : a.getTarget("prev");
  68.           a.flexAnimate(d, c.pauseOnAction)
  69.         });
  70.         c.pausePlay && f.pausePlay.setup();
  71.         c.slideshow && (c.pauseOnHover && a.hover(function () {
  72.           !a.manualPlay && !a.manualPause && a.pause()
  73.         }, function () {
  74.           !a.manualPause && !a.manualPlay && a.play()
  75.         }), 0 < c.initDelay ? setTimeout(a.play, c.initDelay) : a.play());
  76.         p && c.touch && f.touch();
  77.         (!r || r && c.smoothHeight) && d(window).bind("resize focus", f.resize);
  78.         setTimeout(function () {
  79.           c.start(a)
  80.         }, 200)
  81.       },
  82.       asNav: {
  83.         setup: function () {
  84.           a.asNav = !0;
  85.           a.animatingTo = Math.floor(a.currentSlide / a.move);
  86.           a.currentItem = a.currentSlide;
  87.           a.slides.removeClass(e + "active-slide").eq(a.currentItem).addClass(e + "active-slide");
  88.           a.slides.click(function (b) {
  89.             b.preventDefault();
  90.             var b = d(this),
  91.               g = b.index();
  92.             !d(c.asNavFor).data("flexslider").animating && !b.hasClass("active") && (a.direction = a.currentItem < g ? "next" : "prev", a.flexAnimate(g, c.pauseOnAction, !1, !0, !0))
  93.           })
  94.         }
  95.       },
  96.       controlNav: {
  97.         setup: function () {
  98.           a.manualControls ? f.controlNav.setupManual() : f.controlNav.setupPaging()
  99.         },
  100.         setupPaging: function () {
  101.           var b = 1,
  102.             g;
  103.           a.controlNavScaffold = d('<ol class="' + e + "control-nav " + e + ("thumbnails" === c.controlNav ? "control-thumbs" : "control-paging") + '"></ol>');
  104.           if (1 < a.pagingCount) for (var n = 0; n < a.pagingCount; n++) g = "thumbnails" === c.controlNav ? '<a href="' + jQuery(".flex-url").text() + '"><img src="' + a.slides.eq(n).attr("data-thumb") + '"/><div class="thumb-arrow"></div><p class="flex-caption">' + jQuery(".flex-caption").text() + '</p><p class="flex-url">' + jQuery(".flex-url").text() + '</p></a>' : "<a>" + b + "</a>", a.controlNavScaffold.append("<li>" + g + "</li>"), b++;
  105.           a.controlsContainer ? d(a.controlsContainer).append(a.controlNavScaffold) : a.append(a.controlNavScaffold);
  106.           f.controlNav.set();
  107.           f.controlNav.active();
  108.           a.controlNavScaffold.delegate("a, img", t, function (b) {
  109.             b.preventDefault();
  110.             var b = d(this),
  111.               g = a.controlNav.index(b);
  112.             b.hasClass(e + "active") || (a.direction = g > a.currentSlide ? "next" : "prev", a.flexAnimate(g, c.pauseOnAction))
  113.           });
  114.           p && a.controlNavScaffold.delegate("a", "click touchstart", function (a) {
  115.             a.preventDefault()
  116.           })
  117.         },
  118.         setupManual: function () {
  119.           a.controlNav = a.manualControls;
  120.           f.controlNav.active();
  121.           a.controlNav.live(t, function (b) {
  122.             b.preventDefault();
  123.             var b = d(this),
  124.               g = a.controlNav.index(b);
  125.             b.hasClass(e + "active") || (g > a.currentSlide ? a.direction = "next" : a.direction = "prev", a.flexAnimate(g, c.pauseOnAction))
  126.           });
  127.           p && a.controlNav.live("click touchstart", function (a) {
  128.             a.preventDefault()
  129.           })
  130.         },
  131.         set: function () {
  132.           a.controlNav = d("." + e + "control-nav li " + ("thumbnails" === c.controlNav ? "img" : "a"), a.controlsContainer ? a.controlsContainer : a)
  133.         },
  134.         active: function () {
  135.           a.controlNav.removeClass(e + "active").eq(a.animatingTo).addClass(e + "active")
  136.         },
  137.         update: function (b, c) {
  138.           1 < a.pagingCount && "add" === b ? a.controlNavScaffold.append(d("<li><a>" + a.count + "</a></li>")) : 1 === a.pagingCount ? a.controlNavScaffold.find("li").remove() : a.controlNav.eq(c).closest("li").remove();
  139.           f.controlNav.set();
  140.           1 < a.pagingCount && a.pagingCount !== a.controlNav.length ? a.update(c, b) : f.controlNav.active()
  141.         }
  142.       },
  143.       directionNav: {
  144.         setup: function () {
  145.           var b = d('<ul class="' + e + 'direction-nav"><li><a class="' + e + 'prev" href="#">' + c.prevText + '</a></li><li><a class="' + e + 'next" href="#">' + c.nextText + "</a></li></ul>");
  146.           a.controlsContainer ? (d(a.controlsContainer).append(b), a.directionNav = d("." + e + "direction-nav li a", a.controlsContainer)) : (a.append(b), a.directionNav = d("." + e + "direction-nav li a", a));
  147.           f.directionNav.update();
  148.           a.directionNav.bind(t, function (b) {
  149.             b.preventDefault();
  150.             b = d(this).hasClass(e + "next") ? a.getTarget("next") : a.getTarget("prev");
  151.             a.flexAnimate(b, c.pauseOnAction)
  152.           });
  153.           p && a.directionNav.bind("click touchstart", function (a) {
  154.             a.preventDefault()
  155.           })
  156.         },
  157.         update: function () {
  158.           var b = e + "disabled";
  159.           1 === a.pagingCount ? a.directionNav.addClass(b) : c.animationLoop ? a.directionNav.removeClass(b) : 0 === a.animatingTo ? a.directionNav.removeClass(b).filter("." + e + "prev").addClass(b) : a.animatingTo === a.last ? a.directionNav.removeClass(b).filter("." + e + "next").addClass(b) : a.directionNav.removeClass(b)
  160.         }
  161.       },
  162.       pausePlay: {
  163.         setup: function () {
  164.           var b = d('<div class="' + e + 'pauseplay"><a></a></div>');
  165.           a.controlsContainer ? (a.controlsContainer.append(b), a.pausePlay = d("." + e + "pauseplay a", a.controlsContainer)) : (a.append(b), a.pausePlay = d("." + e + "pauseplay a", a));
  166.           f.pausePlay.update(c.slideshow ? e + "pause" : e + "play");
  167.           a.pausePlay.bind(t, function (b) {
  168.             b.preventDefault();
  169.             d(this).hasClass(e + "pause") ? (a.manualPause = !0, a.manualPlay = !1, a.pause()) : (a.manualPause = !1, a.manualPlay = !0, a.play())
  170.           });
  171.           p && a.pausePlay.bind("click touchstart", function (a) {
  172.             a.preventDefault()
  173.           })
  174.         },
  175.         update: function (b) {
  176.           "play" === b ? a.pausePlay.removeClass(e + "pause").addClass(e + "play").text(c.playText) : a.pausePlay.removeClass(e + "play").addClass(e + "pause").text(c.pauseText)
  177.         }
  178.       },
  179.       touch: function () {
  180.         function b(b) {
  181.           j = l ? d - b.touches[0].pageY : d - b.touches[0].pageX;
  182.           p = l ? Math.abs(j) < Math.abs(b.touches[0].pageX - e) : Math.abs(j) < Math.abs(b.touches[0].pageY - e);
  183.           if (!p || 500 < Number(new Date) - k) b.preventDefault(), !r && a.transitions && (c.animationLoop || (j /= 0 === a.currentSlide && 0 > j || a.currentSlide === a.last && 0 < j ? Math.abs(j) / q + 2 : 1), a.setProps(f + j, "setTouch"))
  184.         }
  185.  
  186.         function g() {
  187.           i.removeEventListener("touchmove", b, !1);
  188.           if (a.animatingTo === a.currentSlide && !p && null !== j) {
  189.             var h = m ? -j : j,
  190.               l = 0 < h ? a.getTarget("next") : a.getTarget("prev");
  191.             a.canAdvance(l) && (550 > Number(new Date) - k && 50 < Math.abs(h) || Math.abs(h) > q / 2) ? a.flexAnimate(l, c.pauseOnAction) : r || a.flexAnimate(a.currentSlide, c.pauseOnAction, !0)
  192.           }
  193.           i.removeEventListener("touchend", g, !1);
  194.           f = j = e = d = null
  195.         }
  196.         var d, e, f, q, j, k, p = !1;
  197.         i.addEventListener("touchstart", function (j) {
  198.           a.animating ? j.preventDefault() : 1 === j.touches.length && (a.pause(), q = l ? a.h : a.w, k = Number(new Date), f = h && m && a.animatingTo === a.last ? 0 : h && m ? a.limit - (a.itemW + c.itemMargin) * a.move * a.animatingTo : h && a.currentSlide === a.last ? a.limit : h ? (a.itemW + c.itemMargin) * a.move * a.currentSlide : m ? (a.last - a.currentSlide + a.cloneOffset) * q : (a.currentSlide + a.cloneOffset) * q, d = l ? j.touches[0].pageY : j.touches[0].pageX, e = l ? j.touches[0].pageX : j.touches[0].pageY, i.addEventListener("touchmove", b, !1), i.addEventListener("touchend", g, !1))
  199.         }, !1)
  200.       },
  201.       resize: function () {
  202.         !a.animating && a.is(":visible") && (h || a.doMath(), r ? f.smoothHeight() : h ? (a.slides.width(a.computedW), a.update(a.pagingCount), a.setProps()) : l ? (a.viewport.height(a.h), a.setProps(a.h, "setTotal")) : (c.smoothHeight && f.smoothHeight(), a.newSlides.width(a.computedW), a.setProps(a.computedW, "setTotal")))
  203.       },
  204.       smoothHeight: function (b) {
  205.         if (!l || r) {
  206.           var c = r ? a : a.viewport;
  207.           b ? c.animate({
  208.             height: a.slides.eq(a.animatingTo).height()
  209.           }, b) : c.height(a.slides.eq(a.animatingTo).height())
  210.         }
  211.       },
  212.       sync: function (b) {
  213.         var g = d(c.sync).data("flexslider"),
  214.           e = a.animatingTo;
  215.         switch (b) {
  216.         case "animate":
  217.           g.flexAnimate(e, c.pauseOnAction, !1, !0);
  218.           break;
  219.         case "play":
  220.           !g.playing && !g.asNav && g.play();
  221.           break;
  222.         case "pause":
  223.           g.pause()
  224.         }
  225.       }
  226.     };
  227.     a.flexAnimate = function (b, g, n, i, k) {
  228.       s && 1 === a.pagingCount && (a.direction = a.currentItem < b ? "next" : "prev");
  229.       if (!a.animating && (a.canAdvance(b, k) || n) && a.is(":visible")) {
  230.         if (s && i) if (n = d(c.asNavFor).data("flexslider"), a.atEnd = 0 === b || b === a.count - 1, n.flexAnimate(b, !0, !1, !0, k), a.direction = a.currentItem < b ? "next" : "prev", n.direction = a.direction, Math.ceil((b + 1) / a.visible) - 1 !== a.currentSlide && 0 !== b) a.currentItem = b, a.slides.removeClass(e + "active-slide").eq(b).addClass(e + "active-slide"), b = Math.floor(b / a.visible);
  231.         else return a.currentItem = b, a.slides.removeClass(e + "active-slide").eq(b).addClass(e + "active-slide"), !1;
  232.         a.animating = !0;
  233.         a.animatingTo = b;
  234.         c.before(a);
  235.         g && a.pause();
  236.         a.syncExists && !k && f.sync("animate");
  237.         c.controlNav && f.controlNav.active();
  238.         h || a.slides.removeClass(e + "active-slide").eq(b).addClass(e + "active-slide");
  239.         a.atEnd = 0 === b || b === a.last;
  240.         c.directionNav && f.directionNav.update();
  241.         b === a.last && (c.end(a), c.animationLoop || a.pause());
  242.         if (r) p ? (a.slides.eq(a.currentSlide).css({
  243.           opacity: 0
  244.         }), a.slides.eq(b).css({
  245.           opacity: 1
  246.         }), a.animating = !1, a.currentSlide = a.animatingTo) : (a.slides.eq(a.currentSlide).fadeOut(c.animationSpeed, c.easing), a.slides.eq(b).fadeIn(c.animationSpeed, c.easing, a.wrapup));
  247.         else {
  248.           var q = l ? a.slides.filter(":first").height() : a.computedW;
  249.           h ? (b = c.itemWidth > a.w ? 2 * c.itemMargin : c.itemMargin, b = (a.itemW + b) * a.move * a.animatingTo, b = b > a.limit && 1 !== a.visible ? a.limit : b) : b = 0 === a.currentSlide && b === a.count - 1 && c.animationLoop && "next" !== a.direction ? m ? (a.count + a.cloneOffset) * q : 0 : a.currentSlide === a.last && 0 === b && c.animationLoop && "prev" !== a.direction ? m ? 0 : (a.count + 1) * q : m ? (a.count - 1 - b + a.cloneOffset) * q : (b + a.cloneOffset) * q;
  250.           a.setProps(b, "", c.animationSpeed);
  251.           if (a.transitions) {
  252.             if (!c.animationLoop || !a.atEnd) a.animating = !1, a.currentSlide = a.animatingTo;
  253.             a.container.unbind("webkitTransitionEnd transitionend");
  254.             a.container.bind("webkitTransitionEnd transitionend", function () {
  255.               a.wrapup(q)
  256.             })
  257.           } else a.container.animate(a.args, c.animationSpeed, c.easing, function () {
  258.             a.wrapup(q)
  259.           })
  260.         }
  261.         c.smoothHeight && f.smoothHeight(c.animationSpeed)
  262.       }
  263.     };
  264.     a.wrapup = function (b) {
  265.       !r && !h && (0 === a.currentSlide && a.animatingTo === a.last && c.animationLoop ? a.setProps(b, "jumpEnd") : a.currentSlide === a.last && (0 === a.animatingTo && c.animationLoop) && a.setProps(b, "jumpStart"));
  266.       a.animating = !1;
  267.       a.currentSlide = a.animatingTo;
  268.       c.after(a)
  269.     };
  270.     a.animateSlides = function () {
  271.       a.animating || a.flexAnimate(a.getTarget("next"))
  272.     };
  273.     a.pause = function () {
  274.       clearInterval(a.animatedSlides);
  275.       a.playing = !1;
  276.       c.pausePlay && f.pausePlay.update("play");
  277.       a.syncExists && f.sync("pause")
  278.     };
  279.     a.play = function () {
  280.       a.animatedSlides = setInterval(a.animateSlides, c.slideshowSpeed);
  281.       a.playing = !0;
  282.       c.pausePlay && f.pausePlay.update("pause");
  283.       a.syncExists && f.sync("play")
  284.     };
  285.     a.canAdvance = function (b, g) {
  286.       var d = s ? a.pagingCount - 1 : a.last;
  287.       return g ? !0 : s && a.currentItem === a.count - 1 && 0 === b && "prev" === a.direction ? !0 : s && 0 === a.currentItem && b === a.pagingCount - 1 && "next" !== a.direction ? !1 : b === a.currentSlide && !s ? !1 : c.animationLoop ? !0 : a.atEnd && 0 === a.currentSlide && b === d && "next" !== a.direction ? !1 : a.atEnd && a.currentSlide === d && 0 === b && "next" === a.direction ? !1 : !0
  288.     };
  289.     a.getTarget = function (b) {
  290.       a.direction = b;
  291.       return "next" === b ? a.currentSlide === a.last ? 0 : a.currentSlide + 1 : 0 === a.currentSlide ? a.last : a.currentSlide - 1
  292.     };
  293.     a.setProps = function (b, g, d) {
  294.       var e, f = b ? b : (a.itemW + c.itemMargin) * a.move * a.animatingTo;
  295.       e = -1 *
  296.       function () {
  297.         if (h) return "setTouch" === g ? b : m && a.animatingTo === a.last ? 0 : m ? a.limit - (a.itemW + c.itemMargin) * a.move * a.animatingTo : a.animatingTo === a.last ? a.limit : f;
  298.         switch (g) {
  299.         case "setTotal":
  300.           return m ? (a.count - 1 - a.currentSlide + a.cloneOffset) * b : (a.currentSlide + a.cloneOffset) * b;
  301.         case "setTouch":
  302.           return b;
  303.         case "jumpEnd":
  304.           return m ? b : a.count * b;
  305.         case "jumpStart":
  306.           return m ? a.count * b : b;
  307.         default:
  308.           return b
  309.         }
  310.       }() + "px";
  311.       a.transitions && (e = l ? "translate3d(0," + e + ",0)" : "translate3d(" + e + ",0,0)", d = void 0 !== d ? d / 1E3 + "s" : "0s", a.container.css("-" + a.pfx + "-transition-duration", d));
  312.       a.args[a.prop] = e;
  313.       (a.transitions || void 0 === d) && a.container.css(a.args)
  314.     };
  315.     a.setup = function (b) {
  316.       if (r) a.slides.css({
  317.         width: "100%",
  318.         "float": "left",
  319.         marginRight: "-100%",
  320.         position: "relative"
  321.       }), "init" === b && (p ? a.slides.css({
  322.         opacity: 0,
  323.         display: "block",
  324.         webkitTransition: "opacity " + c.animationSpeed / 1E3 + "s ease"
  325.       }).eq(a.currentSlide).css({
  326.         opacity: 1
  327.       }) : a.slides.eq(a.currentSlide).fadeIn(c.animationSpeed, c.easing)), c.smoothHeight && f.smoothHeight();
  328.       else {
  329.         var g, n;
  330.         "init" === b && (a.viewport = d('<div class="' + e + 'viewport"></div>').css({
  331.           overflow: "hidden",
  332.           position: "relative"
  333.         }).appendTo(a).append(a.container), a.cloneCount = 0, a.cloneOffset = 0, m && (n = d.makeArray(a.slides).reverse(), a.slides = d(n), a.container.empty().append(a.slides)));
  334.         c.animationLoop && !h && (a.cloneCount = 2, a.cloneOffset = 1, "init" !== b && a.container.find(".clone").remove(), a.container.append(a.slides.first().clone().addClass("clone")).prepend(a.slides.last().clone().addClass("clone")));
  335.         a.newSlides = d(c.selector, a);
  336.         g = m ? a.count - 1 - a.currentSlide + a.cloneOffset : a.currentSlide + a.cloneOffset;
  337.         l && !h ? (a.container.height(200 * (a.count + a.cloneCount) + "%").css("position", "absolute").width("100%"), setTimeout(function () {
  338.           a.newSlides.css({
  339.             display: "block"
  340.           });
  341.           a.doMath();
  342.           a.viewport.height(a.h);
  343.           a.setProps(g * a.h, "init")
  344.         }, "init" === b ? 100 : 0)) : (a.container.width(200 * (a.count + a.cloneCount) + "%"), a.setProps(g * a.computedW, "init"), setTimeout(function () {
  345.           a.doMath();
  346.           a.newSlides.css({
  347.             width: a.computedW,
  348.             "float": "left",
  349.             display: "block"
  350.           });
  351.           c.smoothHeight && f.smoothHeight()
  352.         }, "init" === b ? 100 : 0))
  353.       }
  354.       h || a.slides.removeClass(e + "active-slide").eq(a.currentSlide).addClass(e + "active-slide")
  355.     };
  356.     a.doMath = function () {
  357.       var b = a.slides.first(),
  358.         d = c.itemMargin,
  359.         e = c.minItems,
  360.         f = c.maxItems;
  361.       a.w = a.width();
  362.       a.h = b.height();
  363.       a.boxPadding = b.outerWidth() - b.width();
  364.       h ? (a.itemT = c.itemWidth + d, a.minW = e ? e * a.itemT : a.w, a.maxW = f ? f * a.itemT : a.w, a.itemW = a.minW > a.w ? (a.w - d * e) / e : a.maxW < a.w ? (a.w - d * f) / f : c.itemWidth > a.w ? a.w : c.itemWidth, a.visible = Math.floor(a.w / (a.itemW + d)), a.move = 0 < c.move && c.move < a.visible ? c.move : a.visible, a.pagingCount = Math.ceil((a.count - a.visible) / a.move + 1), a.last = a.pagingCount - 1, a.limit = 1 === a.pagingCount ? 0 : c.itemWidth > a.w ? (a.itemW + 2 * d) * a.count - a.w - d : (a.itemW + d) * a.count - a.w - d) : (a.itemW = a.w, a.pagingCount = a.count, a.last = a.count - 1);
  365.       a.computedW = a.itemW - a.boxPadding
  366.     };
  367.     a.update = function (b, d) {
  368.       a.doMath();
  369.       h || (b < a.currentSlide ? a.currentSlide += 1 : b <= a.currentSlide && 0 !== b && (a.currentSlide -= 1), a.animatingTo = a.currentSlide);
  370.       if (c.controlNav && !a.manualControls) if ("add" === d && !h || a.pagingCount > a.controlNav.length) f.controlNav.update("add");
  371.       else if ("remove" === d && !h || a.pagingCount < a.controlNav.length) h && a.currentSlide > a.last && (a.currentSlide -= 1, a.animatingTo -= 1), f.controlNav.update("remove", a.last);
  372.       c.directionNav && f.directionNav.update()
  373.     };
  374.     a.addSlide = function (b, e) {
  375.       var f = d(b);
  376.       a.count += 1;
  377.       a.last = a.count - 1;
  378.       l && m ? void 0 !== e ? a.slides.eq(a.count - e).after(f) : a.container.prepend(f) : void 0 !== e ? a.slides.eq(e).before(f) : a.container.append(f);
  379.       a.update(e, "add");
  380.       a.slides = d(c.selector + ":not(.clone)", a);
  381.       a.setup();
  382.       c.added(a)
  383.     };
  384.     a.removeSlide = function (b) {
  385.       var e = isNaN(b) ? a.slides.index(d(b)) : b;
  386.       a.count -= 1;
  387.       a.last = a.count - 1;
  388.       isNaN(b) ? d(b, a.slides).remove() : l && m ? a.slides.eq(a.last).remove() : a.slides.eq(b).remove();
  389.       a.doMath();
  390.       a.update(e, "remove");
  391.       a.slides = d(c.selector + ":not(.clone)", a);
  392.       a.setup();
  393.       c.removed(a)
  394.     };
  395.     f.init()
  396.   };
  397.   d.flexslider.defaults = {
  398.     namespace: "flex-",
  399.     selector: ".slides > li",
  400.     animation: "fade",
  401.     easing: "swing",
  402.     direction: "horizontal",
  403.     reverse: !1,
  404.     animationLoop: !0,
  405.     smoothHeight: !1,
  406.     startAt: 0,
  407.     slideshow: !0,
  408.     slideshowSpeed: 7E3,
  409.     animationSpeed: 600,
  410.     initDelay: 0,
  411.     randomize: !1,
  412.     pauseOnAction: !0,
  413.     pauseOnHover: !1,
  414.     useCSS: !0,
  415.     touch: !0,
  416.     video: !1,
  417.     controlNav: !0,
  418.     directionNav: !0,
  419.     prevText: "Previous",
  420.     nextText: "Next",
  421.     keyboard: !0,
  422.     multipleKeyboard: !1,
  423.     mousewheel: !1,
  424.     pausePlay: !1,
  425.     pauseText: "Pause",
  426.     playText: "Play",
  427.     controlsContainer: "",
  428.     manualControls: "",
  429.     sync: "",
  430.     asNavFor: "",
  431.     itemWidth: 0,
  432.     itemMargin: 0,
  433.     minItems: 0,
  434.     maxItems: 0,
  435.     move: 0,
  436.     start: function () {},
  437.     before: function () {},
  438.     after: function () {},
  439.     end: function () {},
  440.     added: function () {},
  441.     removed: function () {}
  442.   };
  443.   d.fn.flexslider = function (i) {
  444.     void 0 === i && (i = {});
  445.     if ("object" === typeof i) return this.each(function () {
  446.       var a = d(this),
  447.         c = a.find(i.selector ? i.selector : ".slides > li");
  448.       1 === c.length ? (c.fadeIn(400), i.start && i.start(a)) : void 0 === a.data("flexslider") && new d.flexslider(this, i)
  449.     });
  450.     var k = d(this).data("flexslider");
  451.     switch (i) {
  452.     case "play":
  453.       k.play();
  454.       break;
  455.     case "pause":
  456.       k.pause();
  457.       break;
  458.     case "next":
  459.       k.flexAnimate(k.getTarget("next"), !0);
  460.       break;
  461.     case "prev":
  462.     case "previous":
  463.       k.flexAnimate(k.getTarget("prev"), !0);
  464.       break;
  465.     default:
  466.       "number" === typeof i && k.flexAnimate(i, !0)
  467.     }
  468.   }
  469. })(jQuery);
Advertisement
Add Comment
Please, Sign In to add comment