From 5b629a63cd34f8bd82c0627477761c679579db11 Mon Sep 17 00:00:00 2001 From: Ash Whiting Date: Fri, 23 Aug 2013 15:26:44 +0100 Subject: [PATCH 1/7] Create README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..482ec72 --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +iView +===== + +iView is easy to use jQuery image slider with animated captions, responsive layout and HTML Elements like (Video, iFrame) slider. Easily add unlimited number of slides and captions. Use it as image slider, image gallery, banner rotator, banner ads, or even presentation. From 75bab561a075b5242439557f0259e0ab5d84445d Mon Sep 17 00:00:00 2001 From: Ash Whiting Date: Fri, 23 Aug 2013 16:57:10 +0100 Subject: [PATCH 2/7] Update iview.js Fixed a bug where live() was being used instead of on() - live is now deprecated in jQuery. --- js/iview.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/js/iview.js b/js/iview.js index 5cef83a..75708c3 100644 --- a/js/iview.js +++ b/js/iview.js @@ -271,7 +271,7 @@ } //Play/Pause action - iv.iviewTimer.live('click', function () { + iv.iviewTimer.on('click', function () { if (iv.iviewTimer.hasClass('paused')) { iv.playSlider(); } else { @@ -424,14 +424,14 @@ }, 300); }); - $('a.iview-prevNav', iv.sliderContent).live('click', function () { + $('a.iview-prevNav', iv.sliderContent).on('click', function () { if (iv.defs.lock) return false; iv.cleanTimer(); iv.defs.slide -= 2; iv.goTo('prev'); }); - $('a.iview-nextNav', iv.sliderContent).live('click', function () { + $('a.iview-nextNav', iv.sliderContent).on('click', function () { if (iv.defs.lock) return false; iv.cleanTimer(); iv.goTo('next'); @@ -468,20 +468,20 @@ //Set initial active link $('.iview-controlNav a.iview-control:eq(' + iv.defs.slide + ')', iv.sliderContent).addClass('active'); - $('a.iview-controlPrevNav', iv.sliderContent).live('click', function () { + $('a.iview-controlPrevNav', iv.sliderContent).on('click', function () { if (iv.defs.lock) return false; iv.cleanTimer(); iv.defs.slide -= 2; iv.goTo('prev'); }); - $('a.iview-controlNextNav', iv.sliderContent).live('click', function () { + $('a.iview-controlNextNav', iv.sliderContent).on('click', function () { if (iv.defs.lock) return false; iv.cleanTimer(); iv.goTo('next'); }); - $('.iview-controlNav a.iview-control', iv.sliderContent).live('click', function () { + $('.iview-controlNav a.iview-control', iv.sliderContent).on('click', function () { if (iv.defs.lock) return false; if ($(this).hasClass('active')) return false; iv.cleanTimer(); @@ -1744,4 +1744,4 @@ }; }); -})(jQuery, this); \ No newline at end of file +})(jQuery, this); From 3bc2531312a61f43a3064fdbdd1d1aed673e26df Mon Sep 17 00:00:00 2001 From: Ash Whiting Date: Fri, 23 Aug 2013 16:59:31 +0100 Subject: [PATCH 3/7] Minified updated version --- js/iview.js | 1748 +-------------------------------------------------- 1 file changed, 1 insertion(+), 1747 deletions(-) diff --git a/js/iview.js b/js/iview.js index 75708c3..bd47fb5 100644 --- a/js/iview.js +++ b/js/iview.js @@ -1,1747 +1 @@ -/** - * jQuery iView Slider v2.0 - * - * @version: 2.0.1 - August 17, 2012 - * - * @author: Hemn Chawroka - * hemn@iprodev.com - * http://iprodev.com/ - * - */ (function ($, window, undefined) { - - var iView = function (el, options) { - //Get slider holder - var iv = this; - - iv.options = options; - - iv.sliderContent = el, iv.sliderInner = iv.sliderContent.html(); - - iv.sliderContent.html("
" + iv.sliderInner + "
"); - - //Get slider - iv.slider = $('.iviewSlider', iv.sliderContent); - iv.slider.css('position', 'relative'); - - //Necessary variables. - iv.defs = { - slide: 0, - total: 0, - image: '', - images: [], - width: iv.sliderContent.width(), - height: iv.sliderContent.height(), - timer: options.timer.toLowerCase(), - lock: false, - paused: (options.autoAdvance) ? false : true, - time: options.pauseTime, - easing: options.easing - }; - - //Disable slider text selection - iv.disableSelection(iv.slider[0]); - - //Find slides - iv.slides = iv.slider.children(); - iv.slides.each(function (i) { - var slide = $(this); - - //Find images & thumbnails - iv.defs.images.push(slide.data("iview:image")); - if (slide.data("iview:thumbnail")) iv.defs.images.push(slide.data("iview:thumbnail")); - slide.css('display', 'none'); - - //Find videos - if (slide.data("iview:type") == "video") { - var element = slide.children().eq(0), - video = $(''); - slide.append(video); - element.appendTo($('div.iview-video-container', video)); - video.css({ - width: iv.defs.width, - height: iv.defs.height, - top: '-' + iv.defs.height + 'px' - }).hide(); - slide.addClass('iview-video').css({ - 'cursor': 'pointer' - }); - } - - iv.defs.total++; - }).css({ - width: iv.defs.width, - height: iv.defs.height - }); - - //Set Preloader Element - iv.sliderContent.append('
'); - var iviewPreloader = $('#iview-preloader', iv.sliderContent); - var preloaderBar = $('div', iviewPreloader); - iviewPreloader.css({ - top: ((iv.defs.height / 2) - (iviewPreloader.height() / 2)) + 'px', - left: ((iv.defs.width / 2) - (iviewPreloader.width() / 2)) + 'px' - }); - - //Set Timer Element - iv.sliderContent.append('
'); - iv.iviewTimer = $('#iview-timer', iv.sliderContent); - iv.iviewTimer.hide(); - - //Find captions - $('.iview-caption', iv.slider).each(function (i) { - var caption = $(this); - caption.html('
' + caption.html() + '
'); - }); - - //If randomStart - options.startSlide = (options.randomStart) ? Math.floor(Math.random() * iv.defs.total) : options.startSlide; - - //Set startSlide - options.startSlide = (options.startSlide > 0 && options.startSlide >= iv.defs.total) ? iv.defs.total - 1 : options.startSlide; - iv.defs.slide = options.startSlide; - - //Set first image - iv.defs.image = iv.slides.eq(iv.defs.slide); - - //Set pauseTime - iv.defs.time = (iv.defs.image.data('iview:pausetime')) ? iv.defs.image.data('iview:pausetime') : options.pauseTime; - - //Set easing - iv.defs.easing = (iv.defs.image.data('iview:easing')) ? iv.defs.image.data('iview:easing') : options.easing; - - iv.pieDegree = 0; - var padding = options.timerPadding, - diameter = options.timerDiameter, - stroke = options.timerStroke; - - if (iv.defs.total > 1 && iv.defs.timer != "bar") { - //Start the Raphael - stroke = (iv.defs.timer == "360bar") ? options.timerStroke : 0; - var width = (diameter + (padding * 2) + (stroke * 2)), - height = width, - r = Raphael(iv.iviewTimer[0], width, height); - - iv.R = (diameter / 2); - - var param = { - stroke: options.timerBg, - "stroke-width": (stroke + (padding * 2)) - }, - param2 = { - stroke: options.timerColor, - "stroke-width": stroke, - "stroke-linecap": "round" - }, - param3 = { - fill: options.timerColor, - stroke: 'none', - "stroke-width": 0 - }, - bgParam = { - fill: options.timerBg, - stroke: 'none', - "stroke-width": 0 - }; - - // Custom Arc Attribute - r.customAttributes.arc = function (value, R) { - var total = 360, - alpha = 360 / total * value, - a = (90 - alpha) * Math.PI / 180, - cx = ((diameter / 2) + padding + stroke), - cy = ((diameter / 2) + padding + stroke), - x = cx + R * Math.cos(a), - y = cy - R * Math.sin(a), - path; - if (total == value) { - path = [["M", cx, cy - R], ["A", R, R, 0, 1, 1, 299.99, cy - R]]; - } else { - path = [["M", cx, cy - R], ["A", R, R, 0, +(alpha > 180), 1, x, y]]; - } - return { - path: path - }; - }; - - // Custom Segment Attribute - r.customAttributes.segment = function (angle, R) { - var a1 = -90; - R = R - 1; - angle = (a1 + angle); - var flag = (angle - a1) > 180, - x = ((diameter / 2) + padding), - y = ((diameter / 2) + padding); - a1 = (a1 % 360) * Math.PI / 180; - angle = (angle % 360) * Math.PI / 180; - return { - path: [["M", x, y], ["l", R * Math.cos(a1), R * Math.sin(a1)], ["A", R, R, 0, +flag, 1, x + R * Math.cos(angle), y + R * Math.sin(angle)], ["z"]] - }; - }; - - if (iv.defs.total > 1 && iv.defs.timer == "pie") { - r.circle(iv.R + padding, iv.R + padding, iv.R + padding - 1).attr(bgParam); - } - iv.timerBgPath = r.path().attr(param), iv.timerPath = r.path().attr(param2), iv.pieTimer = r.path().attr(param3); - } - - iv.barTimer = $('div', iv.iviewTimer); - - if (iv.defs.total > 1 && iv.defs.timer == "360bar") { - iv.timerBgPath.attr({ - arc: [359.9, iv.R] - }); - } - - //Set Timer Styles - if (iv.defs.timer == "bar") { - iv.iviewTimer.css({ - opacity: options.timerOpacity, - width: diameter, - height: stroke, - border: options.timerBarStroke + 'px ' + options.timerBarStrokeColor + ' ' + options.timerBarStrokeStyle, - padding: padding, - background: options.timerBg - }); - iv.barTimer.css({ - width: 0, - height: stroke, - background: options.timerColor, - 'float': 'left' - }); - } else { - iv.iviewTimer.css({ - opacity: options.timerOpacity, - width: width, - height: height - }); - } - - //Set Timer Position - iv.setTimerPosition(); - - // Run Preloader - new ImagePreload(iv.defs.images, function (i) { - var percent = (i * 10); - preloaderBar.stop().animate({ - width: percent + '%' - }); - }, function () { - preloaderBar.stop().animate({ - width: '100%' - }, function () { - iviewPreloader.remove(); - iv.startSlider(); - - //Trigger the onAfterLoad callback - options.onAfterLoad.call(this); - }); - }); - - //Touch navigation - iv.sliderContent.bind('swipeleft', function () { - if (iv.defs.lock) return false; - iv.cleanTimer(); - iv.goTo('next'); - }).bind('swiperight', function () { - if (iv.defs.lock) return false; - iv.cleanTimer(); - iv.defs.slide -= 2; - iv.goTo('prev'); - }); - - - - //Keyboard Navigation - if (options.keyboardNav) { - $(document).bind('keyup.iView', function (event) { - //Left - if (event.keyCode == '37') { - if (iv.defs.lock) return false; - iv.cleanTimer(); - iv.defs.slide -= 2; - iv.goTo('prev'); - } - //Right - if (event.keyCode == '39') { - if (iv.defs.lock) return false; - iv.cleanTimer(); - iv.goTo('next'); - } - }); - } - - //Play/Pause action - iv.iviewTimer.on('click', function () { - if (iv.iviewTimer.hasClass('paused')) { - iv.playSlider(); - } else { - iv.stopSlider(); - } - }); - - //Bind the stop action - iv.sliderContent.bind('iView:pause', function () { - iv.stopSlider(); - }); - - //Bind the start action - iv.sliderContent.bind('iView:play', function () { - iv.playSlider(); - }); - - //Bind the start action - iv.sliderContent.bind('iView:previous', function () { - if (iv.defs.lock) return false; - iv.cleanTimer(); - iv.defs.slide -= 2; - iv.goTo('prev'); - }); - - //Bind the start action - iv.sliderContent.bind('iView:next', function () { - if (iv.defs.lock) return false; - iv.cleanTimer(); - iv.goTo('next'); - }); - - //Bind the goSlide action - iv.sliderContent.bind('iView:goSlide', function (event, slide) { - if (iv.defs.lock || iv.defs.slide == slide) return false; - if ($(this).hasClass('active')) return false; - iv.cleanTimer(); - iv.slider.css('background', 'url("' + iv.defs.image.data('iview:image') + '") no-repeat'); - iv.defs.slide = slide - 1; - iv.goTo('control'); - }); - - //Bind the resize action - iv.sliderContent.bind('resize', function () { - - t = $(this), - tW = t.width(), - tH = t.height(), - width = iv.slider.width(), - height = iv.slider.height(); - - if(iv.defs.width != tW){ - var ratio = (tW / width), - newHeight = Math.round(iv.defs.height * ratio); - iv.slider.css({ - '-webkit-transform-origin' : '0 0', - '-moz-transform-origin' : '0 0', - '-o-transform-origin' : '0 0', - '-ms-transform-origin' : '0 0', - 'transform-origin' : '0 0', - '-webkit-transform' : 'scale('+ ratio +')', - '-moz-transform' : 'scale('+ ratio +')', - '-o-transform' : 'scale('+ ratio +')', - '-ms-transform' : 'scale('+ ratio +')', - 'transform' : 'scale('+ ratio +')' - }); - t.css({ height: newHeight }); - iv.defs.width = tW; - - //Set Timer Position - iv.setTimerPosition(); - } - }); - - //Bind video display - $('.iview-video', iv.slider).click(function(e){ - var t = $(this), - video = $('.iview-video-show', t); - if(!$(e.target).hasClass('iview-video-close') && !$(e.target).hasClass('iview-caption') && !$(e.target).parents().hasClass('iview-caption')){ - video.show().animate({ top: 0 }, 1000, 'easeOutBounce'); - iv.sliderContent.trigger('iView:pause'); - } - }); - - //Bind the video closer - $('.iview-video-close', iv.slider).click(function(){ - var video = $(this).parents('.iview-video-show'), - iframe = $('iframe', video), - src = iframe.attr('src'); - - iframe.removeAttr('src').attr('src',src); - - video.animate({ top: '-' + iv.defs.height + 'px' }, 1000, 'easeOutBounce', function(){ - video.hide(); - iv.sliderContent.trigger('iView:play'); - }); - }); - - }; - - //iView helper functions - iView.prototype = { - timer: null, - - //Start Slider - startSlider: function () { - var iv = this; - - var img = new Image(); - img.src = iv.slides.eq(0).data('iview:image'); - imgWidth = img.width; - if(imgWidth != iv.defs.width){ - iv.defs.width = imgWidth; - iv.sliderContent.trigger('resize'); - } - - iv.iviewTimer.show(); - - //Show slide - iv.slides.eq(iv.defs.slide).css('display', 'block'); - - //Set first background - iv.slider.css('background', 'url("' + iv.defs.image.data('iview:image') + '") no-repeat'); - - //Set initial caption - iv.setCaption(iv.options); - - iv.iviewTimer.addClass('paused').attr('title', iv.options.playLabel); - - if (iv.options.autoAdvance && iv.defs.total > 1) { - iv.iviewTimer.removeClass('paused').attr('title', iv.options.pauseLabel); - iv.setTimer(); - } - - //Add Direction nav - if (iv.options.directionNav) { - iv.sliderContent.append(''); - - //Animate Direction nav - $('.iview-directionNav', iv.sliderContent).css({ - opacity: iv.options.directionNavHoverOpacity - }); - iv.sliderContent.hover(function () { - $('.iview-directionNav', iv.sliderContent).stop().animate({ - opacity: 1 - }, 300); - }, function () { - $('.iview-directionNav', iv.sliderContent).stop().animate({ - opacity: iv.options.directionNavHoverOpacity - }, 300); - }); - - $('a.iview-prevNav', iv.sliderContent).on('click', function () { - if (iv.defs.lock) return false; - iv.cleanTimer(); - iv.defs.slide -= 2; - iv.goTo('prev'); - }); - - $('a.iview-nextNav', iv.sliderContent).on('click', function () { - if (iv.defs.lock) return false; - iv.cleanTimer(); - iv.goTo('next'); - }); - } - - //Add Control nav - if (iv.options.controlNav) { - var iviewControl = '
', - iviewTooltip = ''; - if (!iv.options.directionNav && iv.options.controlNavNextPrev) iviewControl += '' + iv.options.previousLabel + ''; - iviewControl += '
    '; - for (var i = 0; i < iv.defs.total; i++) { - var slide = iv.slides.eq(i); - iviewControl += '
  • '; - if (iv.options.controlNavThumbs) { - var thumb = (slide.data('iview:thumbnail')) ? slide.data('iview:thumbnail') : slide.data('iview:image'); - iviewControl += ''; - } else { - var thumb = (slide.data('iview:thumbnail')) ? slide.data('iview:thumbnail') : slide.data('iview:image'); - iviewControl += '' + (i + 1) + ''; - if (iv.options.controlNavTooltip) iviewTooltip += '
    '; - } - iviewControl += '
  • '; - } - iviewControl += '
'; - if (!iv.options.directionNav && iv.options.controlNavNextPrev) iviewControl += '' + iv.options.nextLabel + ''; - iviewControl += '
'; - - if (!iv.options.controlNavThumbs && iv.options.controlNavTooltip) iviewControl += '
' + iviewTooltip + '
'; - - iv.sliderContent.append(iviewControl); - - //Set initial active link - $('.iview-controlNav a.iview-control:eq(' + iv.defs.slide + ')', iv.sliderContent).addClass('active'); - - $('a.iview-controlPrevNav', iv.sliderContent).on('click', function () { - if (iv.defs.lock) return false; - iv.cleanTimer(); - iv.defs.slide -= 2; - iv.goTo('prev'); - }); - - $('a.iview-controlNextNav', iv.sliderContent).on('click', function () { - if (iv.defs.lock) return false; - iv.cleanTimer(); - iv.goTo('next'); - }); - - $('.iview-controlNav a.iview-control', iv.sliderContent).on('click', function () { - if (iv.defs.lock) return false; - if ($(this).hasClass('active')) return false; - iv.cleanTimer(); - iv.slider.css('background', 'url("' + iv.defs.image.data('iview:image') + '") no-repeat'); - iv.defs.slide = $(this).attr('rel') - 1; - iv.goTo('control'); - }); - - //Animate Control nav - $('.iview-controlNav', iv.sliderContent).css({ - opacity: iv.options.controlNavHoverOpacity - }); - iv.sliderContent.hover(function () { - $('.iview-controlNav', iv.sliderContent).stop().animate({ - opacity: 1 - }, 300); - iv.sliderContent.addClass('iview-hover'); - }, function () { - $('.iview-controlNav', iv.sliderContent).stop().animate({ - opacity: iv.options.controlNavHoverOpacity - }, 300); - iv.sliderContent.removeClass('iview-hover'); - }); - - //Show Tooltip - var tooltipTimer = null; - - $('.iview-controlNav a.iview-control', iv.sliderContent).hover(function (e) { - var t = $(this), - i = t.attr('rel'), - tooltip = $('#iview-tooltip', iv.sliderContent), - holder = $('div.holder', tooltip), - x = t.offset().left - iv.sliderContent.offset().left - (tooltip.outerWidth() / 2) + iv.options.tooltipX, - y = t.offset().top - iv.sliderContent.offset().top - tooltip.outerHeight() + iv.options.tooltipY, - imD = $('div[rel=' + i + ']') - scrollLeft = (i * imD.width()); - - tooltip.stop().animate({ - left: x, - top: y, - opacity: 1 - }, 300); - //tooltip.css({ opacity: 1 }); - if (tooltip.not(':visible')) tooltip.fadeIn(300); - holder.stop().animate({ - scrollLeft: scrollLeft - }, 300); - - clearTimeout(tooltipTimer); - - }, function (e) { - var tooltip = $('#iview-tooltip', iv.sliderContent); - tooltipTimer = setTimeout(function () { - tooltip.animate({ - opacity: 0 - }, 300, function () { - tooltip.hide(); - }); - }, 200); - }); - } - - //Bind hover setting - iv.sliderContent.bind('mouseover.iView mousemove.iView', function () { - //Clear the timer - if (iv.options.pauseOnHover && !iv.defs.paused) iv.cleanTimer(); - - iv.sliderContent.addClass('iview-hover'); - }).bind('mouseout.iView', function () { - //Restart the timer - if (iv.options.pauseOnHover && !iv.defs.paused && iv.timer == null && iv.pieDegree <= 359 && iv.options.autoAdvance) iv.setTimer(); - - iv.sliderContent.removeClass('iview-hover'); - }); - }, - - // setCaption function - setCaption: function () { - var iv = this, - slide = iv.slides.eq(iv.defs.slide), - captions = $('.iview-caption', slide), - timeEx = 0; - captions.each(function (i) { - var caption = $(this), - fx = (caption.data('transition')) ? $.trim(caption.data('transition').toLowerCase()) : "fade", - speed = (caption.data('speed')) ? caption.data('speed') : iv.options.captionSpeed, - easing = (caption.data('easing')) ? caption.data('easing') : iv.options.captionEasing, - x = (caption.data('x')!="undefined") ? caption.data('x') : "center", - y = (caption.data('y')!="undefined") ? caption.data('y') : "center", - w = (caption.data('width')) ? caption.data('width') : caption.width(), - h = (caption.data('height')) ? caption.data('height') : caption.height(), - oW = caption.outerWidth(), - oH = caption.outerHeight(); - - if(x == "center") x = ((iv.defs.width/2) - (oW/2)); - if(y == "center") y = ((iv.defs.height/2) - (oH/2)); - - var captionContain = $('.caption-contain', caption); - - caption.css({ - opacity: 0 - }); - captionContain.css({ - opacity: 0, - position: 'relative', - width: w, - height: h - }); - - switch (fx) { - case "wipedown": - caption.css({ - top: (y - h), - left: x - }); - captionContain.css({ - top: (h + (h * 3)), - left: 0 - }); - break; - case "wipeup": - caption.css({ - top: (y + h), - left: x - }); - captionContain.css({ - top: (h - (h * 3)), - left: 0 - }); - break; - case "wiperight": - caption.css({ - top: y, - left: (x - w) - }); - captionContain.css({ - top: 0, - left: (w + (w * 2)) - }); - break; - case "wipeleft": - caption.css({ - top: y, - left: (x + w) - }); - captionContain.css({ - top: 0, - left: (w - (w * 2)) - }); - break; - case "fade": - caption.css({ - top: y, - left: x - }); - captionContain.css({ - top: 0, - left: 0 - }); - break; - case "expanddown": - caption.css({ - top: y, - left: x, - height: 0 - }); - captionContain.css({ - top: (h + (h * 3)), - left: 0 - }); - break; - case "expandup": - caption.css({ - top: (y + h), - left: x, - height: 0 - }); - captionContain.css({ - top: (h - (h * 3)), - left: 0 - }); - break; - case "expandright": - caption.css({ - top: y, - left: x, - width: 0 - }); - captionContain.css({ - top: 0, - left: (w + (w * 2)) - }); - break; - case "expandleft": - caption.css({ - top: y, - left: (x + w), - width: 0 - }); - captionContain.css({ - top: 0, - left: (w - (w * 2)) - }); - break; - } - - setTimeout(function () { - caption.animate({ - opacity: iv.options.captionOpacity, - top: y, - left: x, - width: w, - height: h - }, speed, easing, function () {}); - }, timeEx); - setTimeout(function () { - captionContain.animate({ - opacity: iv.options.captionOpacity, - top: 0, - left: 0 - }, speed, easing); - }, (timeEx + 100)); - timeEx += 250; - }); - }, - - //Process the timer - processTimer: function () { - var iv = this; - if (iv.defs.timer == "360bar") { - var degree = (iv.pieDegree == 0) ? 0 : iv.pieDegree + .9; - iv.timerPath.attr({ - arc: [degree, iv.R] - }); - } else if (iv.defs.timer == "pie") { - var degree = (iv.pieDegree == 0) ? 0 : iv.pieDegree + .9; - iv.pieTimer.attr({ - segment: [degree, iv.R] - }); - } else { - iv.barTimer.css({ - width: ((iv.pieDegree / 360) * 100) + '%' - }); - } - iv.pieDegree += 3; - }, - - //When Animation finishes - transitionEnd: function (iv) { - //Trigger the onAfterChange callback - iv.options.onAfterChange.call(this); - - //Lock the slider - iv.defs.lock = false; - - //Hide slider slides - iv.slides.css('display', 'none'); - - //Diplay the current slide - iv.slides.eq(iv.defs.slide).show(); - - iv.slider.css('background', 'url("' + iv.defs.image.data('iview:image') + '") no-repeat'); - - // Remove any strips and blocks from last transition - $('.iview-strip, .iview-block', iv.slider).remove(); - - //Set slide pauseTime - iv.defs.time = (iv.defs.image.data('iview:pausetime')) ? iv.defs.image.data('iview:pausetime') : iv.options.pauseTime; - - //Process timer - iv.iviewTimer.animate({ - opacity: iv.options.timerOpacity - }); - iv.pieDegree = 0; - iv.processTimer(); - - //Set caption - iv.setCaption(iv.options); - - //Restart the timer - if (iv.timer == null && !iv.defs.paused) iv.timer = setInterval(function () { - iv.timerCall(iv); - }, (iv.defs.time / 120)); - }, - - // Add strips - addStrips: function (vertical, opts) { - var iv = this; - opts = (opts) ? opts : iv.options; - for (var i = 0; i < opts.strips; i++) { - var stripWidth = Math.round(iv.slider.width() / opts.strips), - stripHeight = Math.round(iv.slider.height() / opts.strips), - bgPosition = '-' + ((stripWidth + (i * stripWidth)) - stripWidth) + 'px 0%', - top = ((vertical) ? (stripHeight * i) + 'px' : '0px'), - left = ((vertical) ? '0px' : (stripWidth * i) + 'px'); - if (vertical) bgPosition = '0% -' + ((stripHeight + (i * stripHeight)) - stripHeight) + 'px'; - - if (i == opts.strips - 1) { - var width = ((vertical) ? '0px' : (iv.slider.width() - (stripWidth * i)) + 'px'), - height = ((vertical) ? (iv.slider.height() - (stripHeight * i)) + 'px' : '0px'); - } else { - var width = ((vertical) ? '0px' : stripWidth + 'px'), - height = ((vertical) ? stripHeight + 'px' : '0px'); - } - - var strip = $('
').css({ - width: width, - height: height, - top: top, - left: left, - background: 'url("' + iv.defs.image.data('iview:image') + '") no-repeat ' + bgPosition, - opacity: 0 - }); - - iv.slider.append(strip); - } - }, - - // Add blocks - addBlocks: function () { - var iv = this, - blockWidth = Math.round(iv.slider.width() / iv.options.blockCols), - blockHeight = Math.round(iv.slider.height() / iv.options.blockRows); - - for (var rows = 0; rows < iv.options.blockRows; rows++) { - for (var columns = 0; columns < iv.options.blockCols; columns++) { - var top = (rows * blockHeight) + 'px', - left = (columns * blockWidth) + 'px', - width = blockWidth + 'px', - height = blockHeight + 'px', - bgPosition = '-' + ((blockWidth + (columns * blockWidth)) - blockWidth) + 'px -' + ((blockHeight + (rows * blockHeight)) - blockHeight) + 'px'; - - if (columns == iv.options.blockCols - 1) width = (iv.slider.width() - (blockWidth * columns)) + 'px'; - - var block = $('
').css({ - width: blockWidth + 'px', - height: blockHeight + 'px', - top: (rows * blockHeight) + 'px', - left: (columns * blockWidth) + 'px', - background: 'url("' + iv.defs.image.data('iview:image') + '") no-repeat ' + bgPosition, - opacity: 0 - }); - - iv.slider.append(block); - } - } - }, - - runTransition: function (fx) { - var iv = this; - - switch (fx) { - case 'strip-up-right': - case 'strip-up-left': - iv.addStrips(); - var timeDelay = 0; - i = 0, strips = $('.iview-strip', iv.slider); - if (fx == 'strip-up-left') strips = $('.iview-strip', iv.slider).reverse(); - - strips.each(function () { - var strip = $(this); - strip.css({ - top: '', - bottom: '0px' - }); - - setTimeout(function () { - strip.animate({ - height: '100%', - opacity: '1.0' - }, iv.options.animationSpeed, iv.defs.easing, function () { - if (i == iv.options.strips - 1) iv.transitionEnd(iv); - i++; - }); - }, (100 + timeDelay)); - - timeDelay += 50; - }); - break; - case 'strip-down': - case 'strip-down-right': - case 'strip-down-left': - iv.addStrips(); - var timeDelay = 0, - i = 0, - strips = $('.iview-strip', iv.slider); - if (fx == 'strip-down-left') strips = $('.iview-strip', iv.slider).reverse(); - - strips.each(function () { - var strip = $(this); - strip.css({ - bottom: '', - top: '0px' - }); - - setTimeout(function () { - strip.animate({ - height: '100%', - opacity: '1.0' - }, iv.options.animationSpeed, iv.defs.easing, function () { - if (i == iv.options.strips - 1) iv.transitionEnd(iv); - i++; - }); - }, (100 + timeDelay)); - timeDelay += 50; - }); - break; - case 'strip-left-right': - case 'strip-left-right-up': - case 'strip-left-right-down': - iv.addStrips(true); - var timeDelay = 0, - i = 0, - v = 0, - strips = $('.iview-strip', iv.slider); - if (fx == 'strip-left-right-down') strips = $('.iview-strip', iv.slider).reverse(); - - strips.each(function () { - var strip = $(this); - if (i == 0) { - strip.css({ - right: '', - left: '0px' - }); - i++; - } else { - strip.css({ - left: '', - right: '0px' - }); - i = 0; - } - - setTimeout(function () { - strip.animate({ - width: '100%', - opacity: '1.0' - }, iv.options.animationSpeed, iv.defs.easing, function () { - if (v == iv.options.strips - 1) iv.transitionEnd(iv); - v++; - }); - }, (100 + timeDelay)); - timeDelay += 50; - }); - break; - case 'strip-up-down': - case 'strip-up-down-right': - case 'strip-up-down-left': - iv.addStrips(); - var timeDelay = 0, - i = 0, - v = 0, - strips = $('.iview-strip', iv.slider); - if (fx == 'strip-up-down-left') strips = $('.iview-strip', iv.slider).reverse(); - - strips.each(function () { - var strip = $(this); - if (i == 0) { - strip.css({ - bottom: '', - top: '0px' - }); - i++; - } else { - strip.css({ - top: '', - bottom: '0px' - }); - i = 0; - } - - setTimeout(function () { - strip.animate({ - height: '100%', - opacity: '1.0' - }, iv.options.animationSpeed, iv.defs.easing, function () { - if (v == iv.options.strips - 1) iv.transitionEnd(iv); - v++; - }); - }, (100 + timeDelay)); - timeDelay += 50; - }); - break; - case 'left-curtain': - case 'right-curtain': - case 'top-curtain': - case 'bottom-curtain': - if (fx == 'left-curtain' || fx == 'right-curtain') iv.addStrips(); - else iv.addStrips(true); - var timeDelay = 0, - i = 0, - strips = $('.iview-strip', iv.slider); - - if (fx == 'right-curtain' || fx == 'bottom-curtain') strips = $('.iview-strip', iv.slider).reverse(); - - strips.each(function () { - var strip = $(this); - var width = strip.width(); - var height = strip.height(); - if (fx == 'left-curtain' || fx == 'right-curtain') strip.css({ - top: '0px', - height: '100%', - width: '0px' - }); - else strip.css({ - left: '0px', - height: '0px', - width: '100%' - }); - setTimeout(function () { - if (fx == 'left-curtain' || fx == 'right-curtain') strip.animate({ - width: width, - opacity: '1.0' - }, iv.options.animationSpeed, iv.defs.easing, function () { - if (i == iv.options.strips - 1) iv.transitionEnd(iv); - i++; - }); - else strip.animate({ - height: height, - opacity: '1.0' - }, iv.options.animationSpeed, iv.defs.easing, function () { - if (i == iv.options.strips - 1) iv.transitionEnd(iv); - i++; - }); - }, (100 + timeDelay)); - timeDelay += 50; - }); - break; - case 'strip-up-right': - case 'strip-up-left': - iv.addStrips(); - var timeDelay = 0, - i = 0, - strips = $('.iview-strip', iv.slider); - if (fx == 'strip-up-left') strips = $('.iview-strip', iv.slider).reverse(); - - strips.each(function () { - var strip = $(this); - strip.css({ - 'bottom': '0px' - }); - setTimeout(function () { - strip.animate({ - height: '100%', - opacity: '1.0' - }, iv.options.animationSpeed, iv.defs.easing, function () { - if (i == iv.options.strips - 1) iv.transitionEnd(iv); - i++; - }); - }, (100 + timeDelay)); - timeDelay += 50; - }); - break; - case 'strip-left-fade': - case 'strip-right-fade': - case 'strip-top-fade': - case 'strip-bottom-fade': - if (fx == 'strip-left-fade' || fx == 'strip-right-fade') iv.addStrips(); - else iv.addStrips(true); - var timeDelay = 0, - i = 0, - strips = $('.iview-strip', iv.slider); - - if (fx == 'strip-right-fade' || fx == 'strip-bottom-fade') strips = $('.iview-strip', iv.slider).reverse(); - - strips.each(function () { - var strip = $(this); - var width = strip.width(); - var height = strip.height(); - if (fx == 'strip-left-fade' || fx == 'strip-right-fade') strip.css({ - top: '0px', - height: '100%', - width: width - }); - else strip.css({ - left: '0px', - height: height, - width: '100%' - }); - setTimeout(function () { - strip.animate({ - opacity: '1.0' - }, iv.options.animationSpeed * 1.7, iv.defs.easing, function () { - if (i == iv.options.strips - 1) iv.transitionEnd(iv); - i++; - }); - }, (100 + timeDelay)); - timeDelay += 35; - }); - break; - case 'slide-in-up': - case 'slide-in-down': - opts = { - strips: 1 - }; - iv.addStrips(false, opts); - - var strip = $('.iview-strip:first', iv.slider), - top = 0; - - if (fx == 'slide-in-up') top = '-' + iv.defs.height + 'px'; - else top = iv.defs.height + 'px'; - - strip.css({ - top: top, - 'height': '100%', - 'width': iv.defs.width - }); - - strip.animate({ - 'top': '0px', - opacity: 1 - }, (iv.options.animationSpeed * 2), iv.defs.easing, function () { - iv.transitionEnd(iv); - }); - break; - case 'zigzag-top': - case 'zigzag-bottom': - case 'zigzag-grow-top': - case 'zigzag-grow-bottom': - case 'zigzag-drop-top': - case 'zigzag-drop-bottom': - iv.addBlocks(); - - var totalBlocks = (iv.options.blockCols * iv.options.blockRows), - timeDelay = 0, - blockToArr = new Array(), - blocks = $('.iview-block', iv.slider); - - for (var rows = 0; rows < iv.options.blockRows; rows++) { - var odd = (rows % 2), - start = (rows * iv.options.blockCols), - end = ((rows + 1) * iv.options.blockCols); - if (odd == 1) { - for (var columns = end - 1; columns >= start; columns--) { - blockToArr.push($(blocks[columns])); - } - } else { - for (var columns = start; columns < end; columns++) { - blockToArr.push($(blocks[columns])); - } - } - } - - if (fx == 'zigzag-bottom' || fx == 'zigzag-grow-bottom' || fx == 'zigzag-drop-bottom') blockToArr.reverse(); - - // Run animation - blocks.each(function (i) { - var block = $(blockToArr[i]), - h = block.height(), - w = block.width(), - top = block.css('top'); - - if (fx == 'zigzag-grow-top' || fx == 'zigzag-grow-bottom') block.width(0).height(0); - else if (fx == 'zigzag-drop-top' || fx == 'zigzag-drop-bottom') block.css({ - top: '-=50' - }); - - setTimeout(function () { - if (fx == 'zigzag-grow-top' || fx == 'zigzag-grow-bottom') block.animate({ - opacity: '1', - height: h, - width: w - }, iv.options.animationSpeed, iv.defs.easing, function () { - if (i == totalBlocks - 1) iv.transitionEnd(iv); - }); - else if (fx == 'zigzag-drop-top' || fx == 'zigzag-drop-bottom') block.animate({ - top: top, - opacity: '1' - }, iv.options.animationSpeed, iv.defs.easing, function () { - if (i == totalBlocks - 1) iv.transitionEnd(iv); - }); - else block.animate({ - opacity: '1' - }, (iv.options.animationSpeed * 2), 'easeInOutExpo', function () { - if (i == totalBlocks - 1) iv.transitionEnd(iv); - }); - }, (100 + timeDelay)); - timeDelay += 20; - }); - break; - case 'block-fade': - case 'block-fade-reverse': - case 'block-expand': - case 'block-expand-reverse': - iv.addBlocks(); - - var totalBlocks = (iv.options.blockCols * iv.options.blockRows), - i = 0, - timeDelay = 0; - - // Split blocks into array - var rowIndex = 0; - var colIndex = 0; - var blockToArr = new Array(); - blockToArr[rowIndex] = new Array(); - var blocks = $('.iview-block', iv.slider); - if (fx == 'block-fade-reverse' || fx == 'block-expand-reverse') { - blocks = $('.iview-block', iv.slider).reverse(); - } - blocks.each(function () { - blockToArr[rowIndex][colIndex] = $(this); - colIndex++; - if (colIndex == iv.options.blockCols) { - rowIndex++; - colIndex = 0; - blockToArr[rowIndex] = new Array(); - } - }); - - // Run animation - for (var columns = 0; columns < (iv.options.blockCols * 2); columns++) { - var Col = columns; - for (var rows = 0; rows < iv.options.blockRows; rows++) { - if (Col >= 0 && Col < iv.options.blockCols) { - (function () { - var block = $(blockToArr[rows][Col]); - var w = block.width(); - var h = block.height(); - if (fx == 'block-expand' || fx == 'block-expand-reverse') { - block.width(0).height(0); - } - - setTimeout(function () { - block.animate({ - opacity: '1', - width: w, - height: h - }, iv.options.animationSpeed / 1.3, iv.defs.easing, function () { - if (i == totalBlocks - 1) iv.transitionEnd(iv); - i++; - }); - }, (100 + timeDelay)); - - })(); - } - Col--; - } - timeDelay += 100; - } - break; - case 'block-random': - case 'block-expand-random': - case 'block-drop-random': - iv.addBlocks(); - - var totalBlocks = (iv.options.blockCols * iv.options.blockRows), - timeDelay = 0; - - var blocks = iv.shuffle($('.iview-block', iv.slider)); - blocks.each(function (i) { - var block = $(this), - h = block.height(), - w = block.width(), - top = block.css('top'); - if (fx == 'block-expand-random') block.width(0).height(0); - if (fx == 'block-drop-random') block.css({ - top: '-=50' - }); - - setTimeout(function () { - block.animate({ - top: top, - opacity: '1', - height: h, - width: w - }, iv.options.animationSpeed, iv.defs.easing, function () { - if (i == totalBlocks - 1) iv.transitionEnd(iv); - }); - }, (100 + timeDelay)); - - timeDelay += 20; - }); - break; - case 'slide-in-right': - case 'slide-in-left': - case 'fade': - default: - opts = { - strips: 1 - }; - iv.addStrips(false, opts); - - var strip = $('.iview-strip:first', iv.slider); - strip.css({ - 'height': '100%', - 'width': iv.defs.width - }); - if (fx == 'slide-in-right') strip.css({ - 'height': '100%', - 'width': iv.defs.width, - 'left': iv.defs.width + 'px', - 'right': '' - }); - else if (fx == 'slide-in-left') strip.css({ - 'left': '-' + iv.defs.width + 'px' - }); - - strip.animate({ - left: '0px', - opacity: 1 - }, (iv.options.animationSpeed * 2), iv.defs.easing, function () { - iv.transitionEnd(iv); - }); - break; - } - }, - - // Shuffle an array - shuffle: function (oldArray) { - var newArray = oldArray.slice(); - var len = newArray.length; - var i = len; - while (i--) { - var p = parseInt(Math.random() * len); - var t = newArray[i]; - newArray[i] = newArray[p]; - newArray[p] = t; - } - return newArray; - }, - - // Timer interval caller - timerCall: function (iv) { - iv.processTimer(); - if (iv.pieDegree >= 360) { - iv.cleanTimer(); - iv.goTo(false); - } - }, - - //Set the timer function - setTimer: function () { - var iv = this; - iv.timer = setInterval(function () { - iv.timerCall(iv); - }, (iv.defs.time / 120)); - }, - - //Clean the timer function - cleanTimer: function () { - var iv = this; - clearInterval(iv.timer); - iv.timer = null; - }, - - - // goTo function - goTo: function (action) { - var iv = this; - //Trigger the onLastSlide callback - if (iv.defs && (iv.defs.slide == iv.defs.total - 1)) { - iv.options.onLastSlide.call(this); - } - - iv.cleanTimer(); - - iv.iviewTimer.animate({ - opacity: 0 - }); - - //Trigger the onBeforeChange callback - iv.options.onBeforeChange.call(this); - - //Set current background before change - if (!action) { - iv.slider.css('background', 'url("' + iv.defs.image.data('iview:image') + '") no-repeat'); - } else { - if (action == 'prev' || action == 'next') { - iv.slider.css('background', 'url("' + iv.defs.image.data('iview:image') + '") no-repeat'); - } - } - iv.defs.slide++; - - //Trigger the onSlideShowEnd callback - if (iv.defs.slide == iv.defs.total) { - iv.defs.slide = 0; - iv.options.onSlideShowEnd.call(this); - } - if (iv.defs.slide < 0) iv.defs.slide = (iv.defs.total - 1); - - //Set iv.defs.image - iv.defs.image = iv.slides.eq(iv.defs.slide); - - //Set active links - if (iv.options.controlNav) { - $('.iview-controlNav a.iview-control', iv.sliderContent).removeClass('active'); - $('.iview-controlNav a.iview-control:eq(' + iv.defs.slide + ')', iv.sliderContent).addClass('active'); - } - - var fx = iv.options.fx; - - //Generate random transition - if (iv.options.fx.toLowerCase() == 'random') { - var transitions = new Array('left-curtain', 'right-curtain', 'top-curtain', 'bottom-curtain', 'strip-down-right', 'strip-down-left', 'strip-up-right', 'strip-up-left', 'strip-up-down', 'strip-up-down-left', 'strip-left-right', 'strip-left-right-down', 'slide-in-right', 'slide-in-left', 'slide-in-up', 'slide-in-down', 'fade', 'block-random', 'block-fade', 'block-fade-reverse', 'block-expand', 'block-expand-reverse', 'block-expand-random', 'zigzag-top', 'zigzag-bottom', 'zigzag-grow-top', 'zigzag-grow-bottom', 'zigzag-drop-top', 'zigzag-drop-bottom', 'strip-left-fade', 'strip-right-fade', 'strip-top-fade', 'strip-bottom-fade', 'block-drop-random'); - fx = transitions[Math.floor(Math.random() * (transitions.length + 1))]; - if (fx == undefined) fx = 'fade'; - fx = $.trim(fx.toLowerCase()); - } - - //Run random transition from specified set (eg: effect:'strip-left-fade,right-curtain') - if (iv.options.fx.indexOf(',') != -1) { - var transitions = iv.options.fx.split(','); - fx = transitions[Math.floor(Math.random() * (transitions.length))]; - if (fx == undefined) fx = 'fade'; - fx = $.trim(fx.toLowerCase()); - } - - //Custom transition as defined by "data-iview:transition" attribute - if (iv.defs.image.data('iview:transition')) { - var transitions = iv.defs.image.data('iview:transition').split(','); - fx = transitions[Math.floor(Math.random() * (transitions.length))]; - fx = $.trim(fx.toLowerCase()); - } - - //Set slide easing - iv.defs.easing = (iv.defs.image.data('iview:easing')) ? iv.defs.image.data('iview:easing') : iv.options.easing; - - //Start Transition - iv.defs.lock = true; - iv.runTransition(fx); - }, - - playSlider: function () { - var iv = this; - if (iv.timer == null && iv.defs.paused) { - iv.iviewTimer.removeClass('paused').attr('title', iv.options.pauseLabel); - iv.setTimer(); - iv.defs.paused = false; - - //Trigger the onPlay callback - iv.options.onPlay.call(this); - } - }, - - stopSlider: function () { - var iv = this; - iv.iviewTimer.addClass('paused').attr('title', iv.options.playLabel); - iv.cleanTimer(); - iv.defs.paused = true; - - //Trigger the onPause callback - iv.options.onPause.call(this); - }, - - //Set Timer Position function - setTimerPosition: function(){ - var iv = this, - position = iv.options.timerPosition.toLowerCase().split('-'); - for (var i = 0; i < position.length; i++) { - if (position[i] == 'top') { - iv.iviewTimer.css({ - top: iv.options.timerY + 'px', - bottom: '' - }); - } else if (position[i] == 'middle') { - iv.iviewTimer.css({ - top: (iv.options.timerY + (iv.defs.height / 2) - (iv.options.timerDiameter / 2)) + 'px', - bottom: '' - }); - } else if (position[i] == 'bottom') { - iv.iviewTimer.css({ - bottom: iv.options.timerY + 'px', - top: '' - }); - } else if (position[i] == 'left') { - iv.iviewTimer.css({ - left: iv.options.timerX + 'px', - right: '' - }); - } else if (position[i] == 'center') { - iv.iviewTimer.css({ - left: (iv.options.timerX + (iv.defs.width / 2) - (iv.options.timerDiameter / 2)) + 'px', - right: '' - }); - } else if (position[i] == 'right') { - iv.iviewTimer.css({ - right: iv.options.timerX + 'px', - left: '' - }); - } - } - }, - - disableSelection: function (target) { - if (typeof target.onselectstart != "undefined") target.onselectstart = function () { - return false; - }; - else if (typeof target.style.MozUserSelect != "undefined") target.style.MozUserSelect = "none"; - else if (typeof target.style.webkitUserSelect != "undefined") target.style.webkitUserSelect = "none"; - else if (typeof target.style.userSelect != "undefined") target.style.userSelect = "none"; - else target.onmousedown = function () { - return false; - }; - target.unselectable = "on"; - }, - - //touch - isTouch: function () { - return !!('ontouchstart' in window); - } - }; - - //Image Preloader Function - var ImagePreload = function (p_aImages, p_pfnPercent, p_pfnFinished) { - this.m_pfnPercent = p_pfnPercent; - this.m_pfnFinished = p_pfnFinished; - this.m_nLoaded = 0; - this.m_nProcessed = 0; - this.m_aImages = new Array; - this.m_nICount = p_aImages.length; - for (var i = 0; i < p_aImages.length; i++) this.Preload(p_aImages[i]) - }; - - ImagePreload.prototype = { - Preload: function (p_oImage) { - var oImage = new Image; - this.m_aImages.push(oImage); - oImage.onload = ImagePreload.prototype.OnLoad; - oImage.onerror = ImagePreload.prototype.OnError; - oImage.onabort = ImagePreload.prototype.OnAbort; - oImage.oImagePreload = this; - oImage.bLoaded = false; - oImage.source = p_oImage; - oImage.src = p_oImage - }, - OnComplete: function () { - this.m_nProcessed++; - if (this.m_nProcessed == this.m_nICount) this.m_pfnFinished(); - else this.m_pfnPercent(Math.round((this.m_nProcessed / this.m_nICount) * 10)) - }, - OnLoad: function () { - this.bLoaded = true; - this.oImagePreload.m_nLoaded++; - this.oImagePreload.OnComplete() - }, - OnError: function () { - this.bError = true; - this.oImagePreload.OnComplete() - }, - OnAbort: function () { - this.bAbort = true; - this.oImagePreload.OnComplete() - } - } - - - - // Begin the iView plugin - $.fn.iView = function (options) { - - // Default options. Play carefully. - options = jQuery.extend({ - fx: 'random', - easing: 'easeOutQuad', - strips: 20, - blockCols: 10, - blockRows: 5, - animationSpeed: 500, - pauseTime: 5000, - startSlide: 0, - directionNav: true, - directionNavHoverOpacity: 0.6, - controlNav: false, - controlNavNextPrev: true, - controlNavHoverOpacity: 0.6, - controlNavThumbs: false, - controlNavTooltip: true, - captionSpeed: 500, - captionEasing: 'easeInOutSine', - captionOpacity: 1, - autoAdvance: true, - keyboardNav: true, - touchNav: true, - pauseOnHover: false, - nextLabel: "Next", - previousLabel: "Previous", - playLabel: "Play", - pauseLabel: "Pause", - closeLabel: "Close", - randomStart: false, - timer: 'Pie', - timerBg: '#000', - timerColor: '#EEE', - timerOpacity: 0.5, - timerDiameter: 30, - timerPadding: 4, - timerStroke: 3, - timerBarStroke: 1, - timerBarStrokeColor: '#EEE', - timerBarStrokeStyle: 'solid', - timerPosition: 'top-right', - timerX: 10, - timerY: 10, - tooltipX: 5, - tooltipY: -5, - onBeforeChange: function () {}, - onAfterChange: function () {}, - onAfterLoad: function () {}, - onLastSlide: function () {}, - onSlideShowEnd: function () {}, - onPause: function () {}, - onPlay: function () {} - }, options); - - $(this).each(function () { - var el = $(this); - new iView(el, options); - }); - - }; - - $.fn.reverse = [].reverse; - - var elems = $([]), - jq_resize = $.resize = $.extend($.resize, {}), - timeout_id, str_setTimeout = "setTimeout", - str_resize = "resize", - str_data = str_resize + "-special-event", - str_delay = "delay", - str_throttle = "throttleWindow"; - jq_resize[str_delay] = 250; - jq_resize[str_throttle] = true; - $.event.special[str_resize] = { - setup: function () { - if (!jq_resize[str_throttle] && this[str_setTimeout]) { - return false - } - var elem = $(this); - elems = elems.add(elem); - $.data(this, str_data, { - w: elem.width(), - h: elem.height() - }); - if (elems.length === 1) { - loopy() - } - }, - teardown: function () { - if (!jq_resize[str_throttle] && this[str_setTimeout]) { - return false - } - var elem = $(this); - elems = elems.not(elem); - elem.removeData(str_data); - if (!elems.length) { - clearTimeout(timeout_id) - } - }, - add: function (handleObj) { - if (!jq_resize[str_throttle] && this[str_setTimeout]) { - return false - } - var old_handler; - - function new_handler(e, w, h) { - var elem = $(this), - data = $.data(this, str_data); - data.w = w !== undefined ? w : elem.width(); - data.h = h !== undefined ? h : elem.height(); - old_handler.apply(this, arguments) - } - if ($.isFunction(handleObj)) { - old_handler = handleObj; - return new_handler - } else { - old_handler = handleObj.handler; - handleObj.handler = new_handler - } - } - }; - - function loopy() { - timeout_id = window[str_setTimeout](function () { - elems.each(function () { - var elem = $(this), - width = elem.width(), - height = elem.height(), - data = $.data(this, str_data); - if (width !== data.w || height !== data.h) { - elem.trigger(str_resize, [data.w = width, data.h = height]) - } - }); - loopy() - }, jq_resize[str_delay]) - } - - - var supportTouch = !! ('ontouchstart' in window), - touchStartEvent = supportTouch ? "touchstart" : "mousedown", - touchStopEvent = supportTouch ? "touchend" : "mouseup", - touchMoveEvent = supportTouch ? "touchmove" : "mousemove"; - // also handles swipeleft, swiperight - $.event.special.swipe = { - scrollSupressionThreshold: 10, // More than this horizontal displacement, and we will suppress scrolling. - - durationThreshold: 1000, // More time than this, and it isn't a swipe. - - horizontalDistanceThreshold: 30, // Swipe horizontal displacement must be more than this. - - verticalDistanceThreshold: 75, // Swipe vertical displacement must be less than this. - - setup: function () { - var thisObject = this, - $this = $(thisObject); - - $this.bind(touchStartEvent, function (event) { - var data = event.originalEvent.touches ? event.originalEvent.touches[0] : event, - start = { - time: (new Date()).getTime(), - coords: [data.pageX, data.pageY], - origin: $(event.target) - }, - stop; - - function moveHandler(event) { - - if (!start) { - return; - } - - var data = event.originalEvent.touches ? event.originalEvent.touches[0] : event; - - stop = { - time: (new Date()).getTime(), - coords: [data.pageX, data.pageY] - }; - - // prevent scrolling - if (Math.abs(start.coords[0] - stop.coords[0]) > $.event.special.swipe.scrollSupressionThreshold) { - event.preventDefault(); - } - } - - $this.bind(touchMoveEvent, moveHandler).one(touchStopEvent, function (event) { - $this.unbind(touchMoveEvent, moveHandler); - - if (start && stop) { - if (stop.time - start.time < $.event.special.swipe.durationThreshold && Math.abs(start.coords[0] - stop.coords[0]) > $.event.special.swipe.horizontalDistanceThreshold && Math.abs(start.coords[1] - stop.coords[1]) < $.event.special.swipe.verticalDistanceThreshold) { - - start.origin.trigger("swipe").trigger(start.coords[0] > stop.coords[0] ? "swipeleft" : "swiperight"); - } - } - start = stop = undefined; - }); - }); - } - }; - - - $.each({ - swipeleft: "swipe", - swiperight: "swipe" - }, function (event, sourceEvent) { - - $.event.special[event] = { - setup: function () { - $(this).bind(sourceEvent, $.noop); - } - }; - }); - -})(jQuery, this); +(function(e,n,r){function d(){a=n[f](function(){o.each(function(){var t=e(this),n=t.width(),r=t.height(),i=e.data(this,c);if(n!==i.w||r!==i.h){t.trigger(l,[i.w=n,i.h=r])}});d()},u[h])}var i=function(n,r){var i=this;i.options=r;i.sliderContent=n,i.sliderInner=i.sliderContent.html();i.sliderContent.html("
"+i.sliderInner+"
");i.slider=e(".iviewSlider",i.sliderContent);i.slider.css("position","relative");i.defs={slide:0,total:0,image:"",images:[],width:i.sliderContent.width(),height:i.sliderContent.height(),timer:r.timer.toLowerCase(),lock:false,paused:r.autoAdvance?false:true,time:r.pauseTime,easing:r.easing};i.disableSelection(i.slider[0]);i.slides=i.slider.children();i.slides.each(function(t){var n=e(this);i.defs.images.push(n.data("iview:image"));if(n.data("iview:thumbnail"))i.defs.images.push(n.data("iview:thumbnail"));n.css("display","none");if(n.data("iview:type")=="video"){var s=n.children().eq(0),o=e('');n.append(o);s.appendTo(e("div.iview-video-container",o));o.css({width:i.defs.width,height:i.defs.height,top:"-"+i.defs.height+"px"}).hide();n.addClass("iview-video").css({cursor:"pointer"})}i.defs.total++}).css({width:i.defs.width,height:i.defs.height});i.sliderContent.append('
');var o=e("#iview-preloader",i.sliderContent);var u=e("div",o);o.css({top:i.defs.height/2-o.height()/2+"px",left:i.defs.width/2-o.width()/2+"px"});i.sliderContent.append('
');i.iviewTimer=e("#iview-timer",i.sliderContent);i.iviewTimer.hide();e(".iview-caption",i.slider).each(function(t){var n=e(this);n.html('
'+n.html()+"
")});r.startSlide=r.randomStart?Math.floor(Math.random()*i.defs.total):r.startSlide;r.startSlide=r.startSlide>0&&r.startSlide>=i.defs.total?i.defs.total-1:r.startSlide;i.defs.slide=r.startSlide;i.defs.image=i.slides.eq(i.defs.slide);i.defs.time=i.defs.image.data("iview:pausetime")?i.defs.image.data("iview:pausetime"):r.pauseTime;i.defs.easing=i.defs.image.data("iview:easing")?i.defs.image.data("iview:easing"):r.easing;i.pieDegree=0;var a=r.timerPadding,f=r.timerDiameter,l=r.timerStroke;if(i.defs.total>1&&i.defs.timer!="bar"){l=i.defs.timer=="360bar"?r.timerStroke:0;var c=f+a*2+l*2,h=c,p=Raphael(i.iviewTimer[0],c,h);i.R=f/2;var d={stroke:r.timerBg,"stroke-width":l+a*2},v={stroke:r.timerColor,"stroke-width":l,"stroke-linecap":"round"},m={fill:r.timerColor,stroke:"none","stroke-width":0},g={fill:r.timerBg,stroke:"none","stroke-width":0};p.customAttributes.arc=function(e,t){var n=360,r=360/n*e,i=(90-r)*Math.PI/180,s=f/2+a+l,o=f/2+a+l,u=s+t*Math.cos(i),c=o-t*Math.sin(i),h;if(n==e){h=[["M",s,o-t],["A",t,t,0,1,1,299.99,o-t]]}else{h=[["M",s,o-t],["A",t,t,0,+(r>180),1,u,c]]}return{path:h}};p.customAttributes.segment=function(e,t){var n=-90;t=t-1;e=n+e;var r=e-n>180,i=f/2+a,s=f/2+a;n=n%360*Math.PI/180;e=e%360*Math.PI/180;return{path:[["M",i,s],["l",t*Math.cos(n),t*Math.sin(n)],["A",t,t,0,+r,1,i+t*Math.cos(e),s+t*Math.sin(e)],["z"]]}};if(i.defs.total>1&&i.defs.timer=="pie"){p.circle(i.R+a,i.R+a,i.R+a-1).attr(g)}i.timerBgPath=p.path().attr(d),i.timerPath=p.path().attr(v),i.pieTimer=p.path().attr(m)}i.barTimer=e("div",i.iviewTimer);if(i.defs.total>1&&i.defs.timer=="360bar"){i.timerBgPath.attr({arc:[359.9,i.R]})}if(i.defs.timer=="bar"){i.iviewTimer.css({opacity:r.timerOpacity,width:f,height:l,border:r.timerBarStroke+"px "+r.timerBarStrokeColor+" "+r.timerBarStrokeStyle,padding:a,background:r.timerBg});i.barTimer.css({width:0,height:l,background:r.timerColor,"float":"left"})}else{i.iviewTimer.css({opacity:r.timerOpacity,width:c,height:h})}i.setTimerPosition();new s(i.defs.images,function(e){var t=e*10;u.stop().animate({width:t+"%"})},function(){u.stop().animate({width:"100%"},function(){o.remove();i.startSlider();r.onAfterLoad.call(this)})});i.sliderContent.bind("swipeleft",function(){if(i.defs.lock)return false;i.cleanTimer();i.goTo("next")}).bind("swiperight",function(){if(i.defs.lock)return false;i.cleanTimer();i.defs.slide-=2;i.goTo("prev")});if(r.keyboardNav){e(document).bind("keyup.iView",function(e){if(e.keyCode=="37"){if(i.defs.lock)return false;i.cleanTimer();i.defs.slide-=2;i.goTo("prev")}if(e.keyCode=="39"){if(i.defs.lock)return false;i.cleanTimer();i.goTo("next")}})}i.iviewTimer.on("click",function(){if(i.iviewTimer.hasClass("paused")){i.playSlider()}else{i.stopSlider()}});i.sliderContent.bind("iView:pause",function(){i.stopSlider()});i.sliderContent.bind("iView:play",function(){i.playSlider()});i.sliderContent.bind("iView:previous",function(){if(i.defs.lock)return false;i.cleanTimer();i.defs.slide-=2;i.goTo("prev")});i.sliderContent.bind("iView:next",function(){if(i.defs.lock)return false;i.cleanTimer();i.goTo("next")});i.sliderContent.bind("iView:goSlide",function(t,n){if(i.defs.lock||i.defs.slide==n)return false;if(e(this).hasClass("active"))return false;i.cleanTimer();i.slider.css("background",'url("'+i.defs.image.data("iview:image")+'") no-repeat');i.defs.slide=n-1;i.goTo("control")});i.sliderContent.bind("resize",function(){t=e(this),tW=t.width(),tH=t.height(),c=i.slider.width(),h=i.slider.height();if(i.defs.width!=tW){var n=tW/c,r=Math.round(i.defs.height*n);i.slider.css({"-webkit-transform-origin":"0 0","-moz-transform-origin":"0 0","-o-transform-origin":"0 0","-ms-transform-origin":"0 0","transform-origin":"0 0","-webkit-transform":"scale("+n+")","-moz-transform":"scale("+n+")","-o-transform":"scale("+n+")","-ms-transform":"scale("+n+")",transform:"scale("+n+")"});t.css({height:r});i.defs.width=tW;i.setTimerPosition()}});e(".iview-video",i.slider).click(function(t){var n=e(this),r=e(".iview-video-show",n);if(!e(t.target).hasClass("iview-video-close")&&!e(t.target).hasClass("iview-caption")&&!e(t.target).parents().hasClass("iview-caption")){r.show().animate({top:0},1e3,"easeOutBounce");i.sliderContent.trigger("iView:pause")}});e(".iview-video-close",i.slider).click(function(){var t=e(this).parents(".iview-video-show"),n=e("iframe",t),r=n.attr("src");n.removeAttr("src").attr("src",r);t.animate({top:"-"+i.defs.height+"px"},1e3,"easeOutBounce",function(){t.hide();i.sliderContent.trigger("iView:play")})})};i.prototype={timer:null,startSlider:function(){var t=this;var n=new Image;n.src=t.slides.eq(0).data("iview:image");imgWidth=n.width;if(imgWidth!=t.defs.width){t.defs.width=imgWidth;t.sliderContent.trigger("resize")}t.iviewTimer.show();t.slides.eq(t.defs.slide).css("display","block");t.slider.css("background",'url("'+t.defs.image.data("iview:image")+'") no-repeat');t.setCaption(t.options);t.iviewTimer.addClass("paused").attr("title",t.options.playLabel);if(t.options.autoAdvance&&t.defs.total>1){t.iviewTimer.removeClass("paused").attr("title",t.options.pauseLabel);t.setTimer()}if(t.options.directionNav){t.sliderContent.append('");e(".iview-directionNav",t.sliderContent).css({opacity:t.options.directionNavHoverOpacity});t.sliderContent.hover(function(){e(".iview-directionNav",t.sliderContent).stop().animate({opacity:1},300)},function(){e(".iview-directionNav",t.sliderContent).stop().animate({opacity:t.options.directionNavHoverOpacity},300)});e("a.iview-prevNav",t.sliderContent).on("click",function(){if(t.defs.lock)return false;t.cleanTimer();t.defs.slide-=2;t.goTo("prev")});e("a.iview-nextNav",t.sliderContent).on("click",function(){if(t.defs.lock)return false;t.cleanTimer();t.goTo("next")})}if(t.options.controlNav){var r='
',i="";if(!t.options.directionNav&&t.options.controlNavNextPrev)r+=''+t.options.previousLabel+"";r+='
    ';for(var s=0;s";if(t.options.controlNavThumbs){var u=o.data("iview:thumbnail")?o.data("iview:thumbnail"):o.data("iview:image");r+=''}else{var u=o.data("iview:thumbnail")?o.data("iview:thumbnail"):o.data("iview:image");r+=''+(s+1)+"";if(t.options.controlNavTooltip)i+='
    '}r+=""}r+="
";if(!t.options.directionNav&&t.options.controlNavNextPrev)r+=''+t.options.nextLabel+"";r+="
";if(!t.options.controlNavThumbs&&t.options.controlNavTooltip)r+='
'+i+"
";t.sliderContent.append(r);e(".iview-controlNav a.iview-control:eq("+t.defs.slide+")",t.sliderContent).addClass("active");e("a.iview-controlPrevNav",t.sliderContent).on("click",function(){if(t.defs.lock)return false;t.cleanTimer();t.defs.slide-=2;t.goTo("prev")});e("a.iview-controlNextNav",t.sliderContent).on("click",function(){if(t.defs.lock)return false;t.cleanTimer();t.goTo("next")});e(".iview-controlNav a.iview-control",t.sliderContent).on("click",function(){if(t.defs.lock)return false;if(e(this).hasClass("active"))return false;t.cleanTimer();t.slider.css("background",'url("'+t.defs.image.data("iview:image")+'") no-repeat');t.defs.slide=e(this).attr("rel")-1;t.goTo("control")});e(".iview-controlNav",t.sliderContent).css({opacity:t.options.controlNavHoverOpacity});t.sliderContent.hover(function(){e(".iview-controlNav",t.sliderContent).stop().animate({opacity:1},300);t.sliderContent.addClass("iview-hover")},function(){e(".iview-controlNav",t.sliderContent).stop().animate({opacity:t.options.controlNavHoverOpacity},300);t.sliderContent.removeClass("iview-hover")});var a=null;e(".iview-controlNav a.iview-control",t.sliderContent).hover(function(n){var r=e(this),i=r.attr("rel"),s=e("#iview-tooltip",t.sliderContent),o=e("div.holder",s),u=r.offset().left-t.sliderContent.offset().left-s.outerWidth()/2+t.options.tooltipX,f=r.offset().top-t.sliderContent.offset().top-s.outerHeight()+t.options.tooltipY,l=e("div[rel="+i+"]");scrollLeft=i*l.width();s.stop().animate({left:u,top:f,opacity:1},300);if(s.not(":visible"))s.fadeIn(300);o.stop().animate({scrollLeft:scrollLeft},300);clearTimeout(a)},function(n){var r=e("#iview-tooltip",t.sliderContent);a=setTimeout(function(){r.animate({opacity:0},300,function(){r.hide()})},200)})}t.sliderContent.bind("mouseover.iView mousemove.iView",function(){if(t.options.pauseOnHover&&!t.defs.paused)t.cleanTimer();t.sliderContent.addClass("iview-hover")}).bind("mouseout.iView",function(){if(t.options.pauseOnHover&&!t.defs.paused&&t.timer==null&&t.pieDegree<=359&&t.options.autoAdvance)t.setTimer();t.sliderContent.removeClass("iview-hover")})},setCaption:function(){var t=this,n=t.slides.eq(t.defs.slide),r=e(".iview-caption",n),i=0;r.each(function(n){var r=e(this),s=r.data("transition")?e.trim(r.data("transition").toLowerCase()):"fade",o=r.data("speed")?r.data("speed"):t.options.captionSpeed,u=r.data("easing")?r.data("easing"):t.options.captionEasing,a=r.data("x")!="undefined"?r.data("x"):"center",f=r.data("y")!="undefined"?r.data("y"):"center",l=r.data("width")?r.data("width"):r.width(),c=r.data("height")?r.data("height"):r.height(),h=r.outerWidth(),p=r.outerHeight();if(a=="center")a=t.defs.width/2-h/2;if(f=="center")f=t.defs.height/2-p/2;var d=e(".caption-contain",r);r.css({opacity:0});d.css({opacity:0,position:"relative",width:l,height:c});switch(s){case"wipedown":r.css({top:f-c,left:a});d.css({top:c+c*3,left:0});break;case"wipeup":r.css({top:f+c,left:a});d.css({top:c-c*3,left:0});break;case"wiperight":r.css({top:f,left:a-l});d.css({top:0,left:l+l*2});break;case"wipeleft":r.css({top:f,left:a+l});d.css({top:0,left:l-l*2});break;case"fade":r.css({top:f,left:a});d.css({top:0,left:0});break;case"expanddown":r.css({top:f,left:a,height:0});d.css({top:c+c*3,left:0});break;case"expandup":r.css({top:f+c,left:a,height:0});d.css({top:c-c*3,left:0});break;case"expandright":r.css({top:f,left:a,width:0});d.css({top:0,left:l+l*2});break;case"expandleft":r.css({top:f,left:a+l,width:0});d.css({top:0,left:l-l*2});break}setTimeout(function(){r.animate({opacity:t.options.captionOpacity,top:f,left:a,width:l,height:c},o,u,function(){})},i);setTimeout(function(){d.animate({opacity:t.options.captionOpacity,top:0,left:0},o,u)},i+100);i+=250})},processTimer:function(){var e=this;if(e.defs.timer=="360bar"){var t=e.pieDegree==0?0:e.pieDegree+.9;e.timerPath.attr({arc:[t,e.R]})}else if(e.defs.timer=="pie"){var t=e.pieDegree==0?0:e.pieDegree+.9;e.pieTimer.attr({segment:[t,e.R]})}else{e.barTimer.css({width:e.pieDegree/360*100+"%"})}e.pieDegree+=3},transitionEnd:function(t){t.options.onAfterChange.call(this);t.defs.lock=false;t.slides.css("display","none");t.slides.eq(t.defs.slide).show();t.slider.css("background",'url("'+t.defs.image.data("iview:image")+'") no-repeat');e(".iview-strip, .iview-block",t.slider).remove();t.defs.time=t.defs.image.data("iview:pausetime")?t.defs.image.data("iview:pausetime"):t.options.pauseTime;t.iviewTimer.animate({opacity:t.options.timerOpacity});t.pieDegree=0;t.processTimer();t.setCaption(t.options);if(t.timer==null&&!t.defs.paused)t.timer=setInterval(function(){t.timerCall(t)},t.defs.time/120)},addStrips:function(t,n){var r=this;n=n?n:r.options;for(var i=0;i').css({width:l,height:c,top:a,left:f,background:'url("'+r.defs.image.data("iview:image")+'") no-repeat '+u,opacity:0});r.slider.append(h)}},addBlocks:function(){var t=this,n=Math.round(t.slider.width()/t.options.blockCols),r=Math.round(t.slider.height()/t.options.blockRows);for(var i=0;i').css({width:n+"px",height:r+"px",top:i*r+"px",left:s*n+"px",background:'url("'+t.defs.image.data("iview:image")+'") no-repeat '+l,opacity:0});t.slider.append(c)}}},runTransition:function(t){var n=this;switch(t){case"strip-up-right":case"strip-up-left":n.addStrips();var r=0;i=0,s=e(".iview-strip",n.slider);if(t=="strip-up-left")s=e(".iview-strip",n.slider).reverse();s.each(function(){var t=e(this);t.css({top:"",bottom:"0px"});setTimeout(function(){t.animate({height:"100%",opacity:"1.0"},n.options.animationSpeed,n.defs.easing,function(){if(i==n.options.strips-1)n.transitionEnd(n);i++})},100+r);r+=50});break;case"strip-down":case"strip-down-right":case"strip-down-left":n.addStrips();var r=0,i=0,s=e(".iview-strip",n.slider);if(t=="strip-down-left")s=e(".iview-strip",n.slider).reverse();s.each(function(){var t=e(this);t.css({bottom:"",top:"0px"});setTimeout(function(){t.animate({height:"100%",opacity:"1.0"},n.options.animationSpeed,n.defs.easing,function(){if(i==n.options.strips-1)n.transitionEnd(n);i++})},100+r);r+=50});break;case"strip-left-right":case"strip-left-right-up":case"strip-left-right-down":n.addStrips(true);var r=0,i=0,o=0,s=e(".iview-strip",n.slider);if(t=="strip-left-right-down")s=e(".iview-strip",n.slider).reverse();s.each(function(){var t=e(this);if(i==0){t.css({right:"",left:"0px"});i++}else{t.css({left:"",right:"0px"});i=0}setTimeout(function(){t.animate({width:"100%",opacity:"1.0"},n.options.animationSpeed,n.defs.easing,function(){if(o==n.options.strips-1)n.transitionEnd(n);o++})},100+r);r+=50});break;case"strip-up-down":case"strip-up-down-right":case"strip-up-down-left":n.addStrips();var r=0,i=0,o=0,s=e(".iview-strip",n.slider);if(t=="strip-up-down-left")s=e(".iview-strip",n.slider).reverse();s.each(function(){var t=e(this);if(i==0){t.css({bottom:"",top:"0px"});i++}else{t.css({top:"",bottom:"0px"});i=0}setTimeout(function(){t.animate({height:"100%",opacity:"1.0"},n.options.animationSpeed,n.defs.easing,function(){if(o==n.options.strips-1)n.transitionEnd(n);o++})},100+r);r+=50});break;case"left-curtain":case"right-curtain":case"top-curtain":case"bottom-curtain":if(t=="left-curtain"||t=="right-curtain")n.addStrips();else n.addStrips(true);var r=0,i=0,s=e(".iview-strip",n.slider);if(t=="right-curtain"||t=="bottom-curtain")s=e(".iview-strip",n.slider).reverse();s.each(function(){var s=e(this);var o=s.width();var u=s.height();if(t=="left-curtain"||t=="right-curtain")s.css({top:"0px",height:"100%",width:"0px"});else s.css({left:"0px",height:"0px",width:"100%"});setTimeout(function(){if(t=="left-curtain"||t=="right-curtain")s.animate({width:o,opacity:"1.0"},n.options.animationSpeed,n.defs.easing,function(){if(i==n.options.strips-1)n.transitionEnd(n);i++});else s.animate({height:u,opacity:"1.0"},n.options.animationSpeed,n.defs.easing,function(){if(i==n.options.strips-1)n.transitionEnd(n);i++})},100+r);r+=50});break;case"strip-up-right":case"strip-up-left":n.addStrips();var r=0,i=0,s=e(".iview-strip",n.slider);if(t=="strip-up-left")s=e(".iview-strip",n.slider).reverse();s.each(function(){var t=e(this);t.css({bottom:"0px"});setTimeout(function(){t.animate({height:"100%",opacity:"1.0"},n.options.animationSpeed,n.defs.easing,function(){if(i==n.options.strips-1)n.transitionEnd(n);i++})},100+r);r+=50});break;case"strip-left-fade":case"strip-right-fade":case"strip-top-fade":case"strip-bottom-fade":if(t=="strip-left-fade"||t=="strip-right-fade")n.addStrips();else n.addStrips(true);var r=0,i=0,s=e(".iview-strip",n.slider);if(t=="strip-right-fade"||t=="strip-bottom-fade")s=e(".iview-strip",n.slider).reverse();s.each(function(){var s=e(this);var o=s.width();var u=s.height();if(t=="strip-left-fade"||t=="strip-right-fade")s.css({top:"0px",height:"100%",width:o});else s.css({left:"0px",height:u,width:"100%"});setTimeout(function(){s.animate({opacity:"1.0"},n.options.animationSpeed*1.7,n.defs.easing,function(){if(i==n.options.strips-1)n.transitionEnd(n);i++})},100+r);r+=35});break;case"slide-in-up":case"slide-in-down":opts={strips:1};n.addStrips(false,opts);var u=e(".iview-strip:first",n.slider),a=0;if(t=="slide-in-up")a="-"+n.defs.height+"px";else a=n.defs.height+"px";u.css({top:a,height:"100%",width:n.defs.width});u.animate({top:"0px",opacity:1},n.options.animationSpeed*2,n.defs.easing,function(){n.transitionEnd(n)});break;case"zigzag-top":case"zigzag-bottom":case"zigzag-grow-top":case"zigzag-grow-bottom":case"zigzag-drop-top":case"zigzag-drop-bottom":n.addBlocks();var f=n.options.blockCols*n.options.blockRows,r=0,l=new Array,c=e(".iview-block",n.slider);for(var h=0;h=d;m--){l.push(e(c[m]))}}else{for(var m=d;m=0&&b=360){e.cleanTimer();e.goTo(false)}},setTimer:function(){var e=this;e.timer=setInterval(function(){e.timerCall(e)},e.defs.time/120)},cleanTimer:function(){var e=this;clearInterval(e.timer);e.timer=null},goTo:function(t){var n=this;if(n.defs&&n.defs.slide==n.defs.total-1){n.options.onLastSlide.call(this)}n.cleanTimer();n.iviewTimer.animate({opacity:0});n.options.onBeforeChange.call(this);if(!t){n.slider.css("background",'url("'+n.defs.image.data("iview:image")+'") no-repeat')}else{if(t=="prev"||t=="next"){n.slider.css("background",'url("'+n.defs.image.data("iview:image")+'") no-repeat')}}n.defs.slide++;if(n.defs.slide==n.defs.total){n.defs.slide=0;n.options.onSlideShowEnd.call(this)}if(n.defs.slide<0)n.defs.slide=n.defs.total-1;n.defs.image=n.slides.eq(n.defs.slide);if(n.options.controlNav){e(".iview-controlNav a.iview-control",n.sliderContent).removeClass("active");e(".iview-controlNav a.iview-control:eq("+n.defs.slide+")",n.sliderContent).addClass("active")}var i=n.options.fx;if(n.options.fx.toLowerCase()=="random"){var s=new Array("left-curtain","right-curtain","top-curtain","bottom-curtain","strip-down-right","strip-down-left","strip-up-right","strip-up-left","strip-up-down","strip-up-down-left","strip-left-right","strip-left-right-down","slide-in-right","slide-in-left","slide-in-up","slide-in-down","fade","block-random","block-fade","block-fade-reverse","block-expand","block-expand-reverse","block-expand-random","zigzag-top","zigzag-bottom","zigzag-grow-top","zigzag-grow-bottom","zigzag-drop-top","zigzag-drop-bottom","strip-left-fade","strip-right-fade","strip-top-fade","strip-bottom-fade","block-drop-random");i=s[Math.floor(Math.random()*(s.length+1))];if(i==r)i="fade";i=e.trim(i.toLowerCase())}if(n.options.fx.indexOf(",")!=-1){var s=n.options.fx.split(",");i=s[Math.floor(Math.random()*s.length)];if(i==r)i="fade";i=e.trim(i.toLowerCase())}if(n.defs.image.data("iview:transition")){var s=n.defs.image.data("iview:transition").split(",");i=s[Math.floor(Math.random()*s.length)];i=e.trim(i.toLowerCase())}n.defs.easing=n.defs.image.data("iview:easing")?n.defs.image.data("iview:easing"):n.options.easing;n.defs.lock=true;n.runTransition(i)},playSlider:function(){var e=this;if(e.timer==null&&e.defs.paused){e.iviewTimer.removeClass("paused").attr("title",e.options.pauseLabel);e.setTimer();e.defs.paused=false;e.options.onPlay.call(this)}},stopSlider:function(){var e=this;e.iviewTimer.addClass("paused").attr("title",e.options.playLabel);e.cleanTimer();e.defs.paused=true;e.options.onPause.call(this)},setTimerPosition:function(){var e=this,t=e.options.timerPosition.toLowerCase().split("-");for(var n=0;ne.event.special.swipe.scrollSupressionThreshold){t.preventDefault()}}var i=t.originalEvent.touches?t.originalEvent.touches[0]:t,s={time:(new Date).getTime(),coords:[i.pageX,i.pageY],origin:e(t.target)},o;n.bind(y,u).one(g,function(t){n.unbind(y,u);if(s&&o){if(o.time-s.timee.event.special.swipe.horizontalDistanceThreshold&&Math.abs(s.coords[1]-o.coords[1])o.coords[0]?"swipeleft":"swiperight")}}s=o=r})})}};e.each({swipeleft:"swipe",swiperight:"swipe"},function(t,n){e.event.special[t]={setup:function(){e(this).bind(n,e.noop)}}})})(jQuery,this) From e58352050374077756790fc1c75b48755018fc96 Mon Sep 17 00:00:00 2001 From: Ash Whiting Date: Fri, 23 Aug 2013 17:00:13 +0100 Subject: [PATCH 4/7] Updated to fixed version Fixed --- js/iview.js | 1748 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 1747 insertions(+), 1 deletion(-) diff --git a/js/iview.js b/js/iview.js index bd47fb5..75708c3 100644 --- a/js/iview.js +++ b/js/iview.js @@ -1 +1,1747 @@ -(function(e,n,r){function d(){a=n[f](function(){o.each(function(){var t=e(this),n=t.width(),r=t.height(),i=e.data(this,c);if(n!==i.w||r!==i.h){t.trigger(l,[i.w=n,i.h=r])}});d()},u[h])}var i=function(n,r){var i=this;i.options=r;i.sliderContent=n,i.sliderInner=i.sliderContent.html();i.sliderContent.html("
"+i.sliderInner+"
");i.slider=e(".iviewSlider",i.sliderContent);i.slider.css("position","relative");i.defs={slide:0,total:0,image:"",images:[],width:i.sliderContent.width(),height:i.sliderContent.height(),timer:r.timer.toLowerCase(),lock:false,paused:r.autoAdvance?false:true,time:r.pauseTime,easing:r.easing};i.disableSelection(i.slider[0]);i.slides=i.slider.children();i.slides.each(function(t){var n=e(this);i.defs.images.push(n.data("iview:image"));if(n.data("iview:thumbnail"))i.defs.images.push(n.data("iview:thumbnail"));n.css("display","none");if(n.data("iview:type")=="video"){var s=n.children().eq(0),o=e('');n.append(o);s.appendTo(e("div.iview-video-container",o));o.css({width:i.defs.width,height:i.defs.height,top:"-"+i.defs.height+"px"}).hide();n.addClass("iview-video").css({cursor:"pointer"})}i.defs.total++}).css({width:i.defs.width,height:i.defs.height});i.sliderContent.append('
');var o=e("#iview-preloader",i.sliderContent);var u=e("div",o);o.css({top:i.defs.height/2-o.height()/2+"px",left:i.defs.width/2-o.width()/2+"px"});i.sliderContent.append('
');i.iviewTimer=e("#iview-timer",i.sliderContent);i.iviewTimer.hide();e(".iview-caption",i.slider).each(function(t){var n=e(this);n.html('
'+n.html()+"
")});r.startSlide=r.randomStart?Math.floor(Math.random()*i.defs.total):r.startSlide;r.startSlide=r.startSlide>0&&r.startSlide>=i.defs.total?i.defs.total-1:r.startSlide;i.defs.slide=r.startSlide;i.defs.image=i.slides.eq(i.defs.slide);i.defs.time=i.defs.image.data("iview:pausetime")?i.defs.image.data("iview:pausetime"):r.pauseTime;i.defs.easing=i.defs.image.data("iview:easing")?i.defs.image.data("iview:easing"):r.easing;i.pieDegree=0;var a=r.timerPadding,f=r.timerDiameter,l=r.timerStroke;if(i.defs.total>1&&i.defs.timer!="bar"){l=i.defs.timer=="360bar"?r.timerStroke:0;var c=f+a*2+l*2,h=c,p=Raphael(i.iviewTimer[0],c,h);i.R=f/2;var d={stroke:r.timerBg,"stroke-width":l+a*2},v={stroke:r.timerColor,"stroke-width":l,"stroke-linecap":"round"},m={fill:r.timerColor,stroke:"none","stroke-width":0},g={fill:r.timerBg,stroke:"none","stroke-width":0};p.customAttributes.arc=function(e,t){var n=360,r=360/n*e,i=(90-r)*Math.PI/180,s=f/2+a+l,o=f/2+a+l,u=s+t*Math.cos(i),c=o-t*Math.sin(i),h;if(n==e){h=[["M",s,o-t],["A",t,t,0,1,1,299.99,o-t]]}else{h=[["M",s,o-t],["A",t,t,0,+(r>180),1,u,c]]}return{path:h}};p.customAttributes.segment=function(e,t){var n=-90;t=t-1;e=n+e;var r=e-n>180,i=f/2+a,s=f/2+a;n=n%360*Math.PI/180;e=e%360*Math.PI/180;return{path:[["M",i,s],["l",t*Math.cos(n),t*Math.sin(n)],["A",t,t,0,+r,1,i+t*Math.cos(e),s+t*Math.sin(e)],["z"]]}};if(i.defs.total>1&&i.defs.timer=="pie"){p.circle(i.R+a,i.R+a,i.R+a-1).attr(g)}i.timerBgPath=p.path().attr(d),i.timerPath=p.path().attr(v),i.pieTimer=p.path().attr(m)}i.barTimer=e("div",i.iviewTimer);if(i.defs.total>1&&i.defs.timer=="360bar"){i.timerBgPath.attr({arc:[359.9,i.R]})}if(i.defs.timer=="bar"){i.iviewTimer.css({opacity:r.timerOpacity,width:f,height:l,border:r.timerBarStroke+"px "+r.timerBarStrokeColor+" "+r.timerBarStrokeStyle,padding:a,background:r.timerBg});i.barTimer.css({width:0,height:l,background:r.timerColor,"float":"left"})}else{i.iviewTimer.css({opacity:r.timerOpacity,width:c,height:h})}i.setTimerPosition();new s(i.defs.images,function(e){var t=e*10;u.stop().animate({width:t+"%"})},function(){u.stop().animate({width:"100%"},function(){o.remove();i.startSlider();r.onAfterLoad.call(this)})});i.sliderContent.bind("swipeleft",function(){if(i.defs.lock)return false;i.cleanTimer();i.goTo("next")}).bind("swiperight",function(){if(i.defs.lock)return false;i.cleanTimer();i.defs.slide-=2;i.goTo("prev")});if(r.keyboardNav){e(document).bind("keyup.iView",function(e){if(e.keyCode=="37"){if(i.defs.lock)return false;i.cleanTimer();i.defs.slide-=2;i.goTo("prev")}if(e.keyCode=="39"){if(i.defs.lock)return false;i.cleanTimer();i.goTo("next")}})}i.iviewTimer.on("click",function(){if(i.iviewTimer.hasClass("paused")){i.playSlider()}else{i.stopSlider()}});i.sliderContent.bind("iView:pause",function(){i.stopSlider()});i.sliderContent.bind("iView:play",function(){i.playSlider()});i.sliderContent.bind("iView:previous",function(){if(i.defs.lock)return false;i.cleanTimer();i.defs.slide-=2;i.goTo("prev")});i.sliderContent.bind("iView:next",function(){if(i.defs.lock)return false;i.cleanTimer();i.goTo("next")});i.sliderContent.bind("iView:goSlide",function(t,n){if(i.defs.lock||i.defs.slide==n)return false;if(e(this).hasClass("active"))return false;i.cleanTimer();i.slider.css("background",'url("'+i.defs.image.data("iview:image")+'") no-repeat');i.defs.slide=n-1;i.goTo("control")});i.sliderContent.bind("resize",function(){t=e(this),tW=t.width(),tH=t.height(),c=i.slider.width(),h=i.slider.height();if(i.defs.width!=tW){var n=tW/c,r=Math.round(i.defs.height*n);i.slider.css({"-webkit-transform-origin":"0 0","-moz-transform-origin":"0 0","-o-transform-origin":"0 0","-ms-transform-origin":"0 0","transform-origin":"0 0","-webkit-transform":"scale("+n+")","-moz-transform":"scale("+n+")","-o-transform":"scale("+n+")","-ms-transform":"scale("+n+")",transform:"scale("+n+")"});t.css({height:r});i.defs.width=tW;i.setTimerPosition()}});e(".iview-video",i.slider).click(function(t){var n=e(this),r=e(".iview-video-show",n);if(!e(t.target).hasClass("iview-video-close")&&!e(t.target).hasClass("iview-caption")&&!e(t.target).parents().hasClass("iview-caption")){r.show().animate({top:0},1e3,"easeOutBounce");i.sliderContent.trigger("iView:pause")}});e(".iview-video-close",i.slider).click(function(){var t=e(this).parents(".iview-video-show"),n=e("iframe",t),r=n.attr("src");n.removeAttr("src").attr("src",r);t.animate({top:"-"+i.defs.height+"px"},1e3,"easeOutBounce",function(){t.hide();i.sliderContent.trigger("iView:play")})})};i.prototype={timer:null,startSlider:function(){var t=this;var n=new Image;n.src=t.slides.eq(0).data("iview:image");imgWidth=n.width;if(imgWidth!=t.defs.width){t.defs.width=imgWidth;t.sliderContent.trigger("resize")}t.iviewTimer.show();t.slides.eq(t.defs.slide).css("display","block");t.slider.css("background",'url("'+t.defs.image.data("iview:image")+'") no-repeat');t.setCaption(t.options);t.iviewTimer.addClass("paused").attr("title",t.options.playLabel);if(t.options.autoAdvance&&t.defs.total>1){t.iviewTimer.removeClass("paused").attr("title",t.options.pauseLabel);t.setTimer()}if(t.options.directionNav){t.sliderContent.append('");e(".iview-directionNav",t.sliderContent).css({opacity:t.options.directionNavHoverOpacity});t.sliderContent.hover(function(){e(".iview-directionNav",t.sliderContent).stop().animate({opacity:1},300)},function(){e(".iview-directionNav",t.sliderContent).stop().animate({opacity:t.options.directionNavHoverOpacity},300)});e("a.iview-prevNav",t.sliderContent).on("click",function(){if(t.defs.lock)return false;t.cleanTimer();t.defs.slide-=2;t.goTo("prev")});e("a.iview-nextNav",t.sliderContent).on("click",function(){if(t.defs.lock)return false;t.cleanTimer();t.goTo("next")})}if(t.options.controlNav){var r='
',i="";if(!t.options.directionNav&&t.options.controlNavNextPrev)r+=''+t.options.previousLabel+"";r+='
    ';for(var s=0;s";if(t.options.controlNavThumbs){var u=o.data("iview:thumbnail")?o.data("iview:thumbnail"):o.data("iview:image");r+=''}else{var u=o.data("iview:thumbnail")?o.data("iview:thumbnail"):o.data("iview:image");r+=''+(s+1)+"";if(t.options.controlNavTooltip)i+='
    '}r+=""}r+="
";if(!t.options.directionNav&&t.options.controlNavNextPrev)r+=''+t.options.nextLabel+"";r+="
";if(!t.options.controlNavThumbs&&t.options.controlNavTooltip)r+='
'+i+"
";t.sliderContent.append(r);e(".iview-controlNav a.iview-control:eq("+t.defs.slide+")",t.sliderContent).addClass("active");e("a.iview-controlPrevNav",t.sliderContent).on("click",function(){if(t.defs.lock)return false;t.cleanTimer();t.defs.slide-=2;t.goTo("prev")});e("a.iview-controlNextNav",t.sliderContent).on("click",function(){if(t.defs.lock)return false;t.cleanTimer();t.goTo("next")});e(".iview-controlNav a.iview-control",t.sliderContent).on("click",function(){if(t.defs.lock)return false;if(e(this).hasClass("active"))return false;t.cleanTimer();t.slider.css("background",'url("'+t.defs.image.data("iview:image")+'") no-repeat');t.defs.slide=e(this).attr("rel")-1;t.goTo("control")});e(".iview-controlNav",t.sliderContent).css({opacity:t.options.controlNavHoverOpacity});t.sliderContent.hover(function(){e(".iview-controlNav",t.sliderContent).stop().animate({opacity:1},300);t.sliderContent.addClass("iview-hover")},function(){e(".iview-controlNav",t.sliderContent).stop().animate({opacity:t.options.controlNavHoverOpacity},300);t.sliderContent.removeClass("iview-hover")});var a=null;e(".iview-controlNav a.iview-control",t.sliderContent).hover(function(n){var r=e(this),i=r.attr("rel"),s=e("#iview-tooltip",t.sliderContent),o=e("div.holder",s),u=r.offset().left-t.sliderContent.offset().left-s.outerWidth()/2+t.options.tooltipX,f=r.offset().top-t.sliderContent.offset().top-s.outerHeight()+t.options.tooltipY,l=e("div[rel="+i+"]");scrollLeft=i*l.width();s.stop().animate({left:u,top:f,opacity:1},300);if(s.not(":visible"))s.fadeIn(300);o.stop().animate({scrollLeft:scrollLeft},300);clearTimeout(a)},function(n){var r=e("#iview-tooltip",t.sliderContent);a=setTimeout(function(){r.animate({opacity:0},300,function(){r.hide()})},200)})}t.sliderContent.bind("mouseover.iView mousemove.iView",function(){if(t.options.pauseOnHover&&!t.defs.paused)t.cleanTimer();t.sliderContent.addClass("iview-hover")}).bind("mouseout.iView",function(){if(t.options.pauseOnHover&&!t.defs.paused&&t.timer==null&&t.pieDegree<=359&&t.options.autoAdvance)t.setTimer();t.sliderContent.removeClass("iview-hover")})},setCaption:function(){var t=this,n=t.slides.eq(t.defs.slide),r=e(".iview-caption",n),i=0;r.each(function(n){var r=e(this),s=r.data("transition")?e.trim(r.data("transition").toLowerCase()):"fade",o=r.data("speed")?r.data("speed"):t.options.captionSpeed,u=r.data("easing")?r.data("easing"):t.options.captionEasing,a=r.data("x")!="undefined"?r.data("x"):"center",f=r.data("y")!="undefined"?r.data("y"):"center",l=r.data("width")?r.data("width"):r.width(),c=r.data("height")?r.data("height"):r.height(),h=r.outerWidth(),p=r.outerHeight();if(a=="center")a=t.defs.width/2-h/2;if(f=="center")f=t.defs.height/2-p/2;var d=e(".caption-contain",r);r.css({opacity:0});d.css({opacity:0,position:"relative",width:l,height:c});switch(s){case"wipedown":r.css({top:f-c,left:a});d.css({top:c+c*3,left:0});break;case"wipeup":r.css({top:f+c,left:a});d.css({top:c-c*3,left:0});break;case"wiperight":r.css({top:f,left:a-l});d.css({top:0,left:l+l*2});break;case"wipeleft":r.css({top:f,left:a+l});d.css({top:0,left:l-l*2});break;case"fade":r.css({top:f,left:a});d.css({top:0,left:0});break;case"expanddown":r.css({top:f,left:a,height:0});d.css({top:c+c*3,left:0});break;case"expandup":r.css({top:f+c,left:a,height:0});d.css({top:c-c*3,left:0});break;case"expandright":r.css({top:f,left:a,width:0});d.css({top:0,left:l+l*2});break;case"expandleft":r.css({top:f,left:a+l,width:0});d.css({top:0,left:l-l*2});break}setTimeout(function(){r.animate({opacity:t.options.captionOpacity,top:f,left:a,width:l,height:c},o,u,function(){})},i);setTimeout(function(){d.animate({opacity:t.options.captionOpacity,top:0,left:0},o,u)},i+100);i+=250})},processTimer:function(){var e=this;if(e.defs.timer=="360bar"){var t=e.pieDegree==0?0:e.pieDegree+.9;e.timerPath.attr({arc:[t,e.R]})}else if(e.defs.timer=="pie"){var t=e.pieDegree==0?0:e.pieDegree+.9;e.pieTimer.attr({segment:[t,e.R]})}else{e.barTimer.css({width:e.pieDegree/360*100+"%"})}e.pieDegree+=3},transitionEnd:function(t){t.options.onAfterChange.call(this);t.defs.lock=false;t.slides.css("display","none");t.slides.eq(t.defs.slide).show();t.slider.css("background",'url("'+t.defs.image.data("iview:image")+'") no-repeat');e(".iview-strip, .iview-block",t.slider).remove();t.defs.time=t.defs.image.data("iview:pausetime")?t.defs.image.data("iview:pausetime"):t.options.pauseTime;t.iviewTimer.animate({opacity:t.options.timerOpacity});t.pieDegree=0;t.processTimer();t.setCaption(t.options);if(t.timer==null&&!t.defs.paused)t.timer=setInterval(function(){t.timerCall(t)},t.defs.time/120)},addStrips:function(t,n){var r=this;n=n?n:r.options;for(var i=0;i').css({width:l,height:c,top:a,left:f,background:'url("'+r.defs.image.data("iview:image")+'") no-repeat '+u,opacity:0});r.slider.append(h)}},addBlocks:function(){var t=this,n=Math.round(t.slider.width()/t.options.blockCols),r=Math.round(t.slider.height()/t.options.blockRows);for(var i=0;i').css({width:n+"px",height:r+"px",top:i*r+"px",left:s*n+"px",background:'url("'+t.defs.image.data("iview:image")+'") no-repeat '+l,opacity:0});t.slider.append(c)}}},runTransition:function(t){var n=this;switch(t){case"strip-up-right":case"strip-up-left":n.addStrips();var r=0;i=0,s=e(".iview-strip",n.slider);if(t=="strip-up-left")s=e(".iview-strip",n.slider).reverse();s.each(function(){var t=e(this);t.css({top:"",bottom:"0px"});setTimeout(function(){t.animate({height:"100%",opacity:"1.0"},n.options.animationSpeed,n.defs.easing,function(){if(i==n.options.strips-1)n.transitionEnd(n);i++})},100+r);r+=50});break;case"strip-down":case"strip-down-right":case"strip-down-left":n.addStrips();var r=0,i=0,s=e(".iview-strip",n.slider);if(t=="strip-down-left")s=e(".iview-strip",n.slider).reverse();s.each(function(){var t=e(this);t.css({bottom:"",top:"0px"});setTimeout(function(){t.animate({height:"100%",opacity:"1.0"},n.options.animationSpeed,n.defs.easing,function(){if(i==n.options.strips-1)n.transitionEnd(n);i++})},100+r);r+=50});break;case"strip-left-right":case"strip-left-right-up":case"strip-left-right-down":n.addStrips(true);var r=0,i=0,o=0,s=e(".iview-strip",n.slider);if(t=="strip-left-right-down")s=e(".iview-strip",n.slider).reverse();s.each(function(){var t=e(this);if(i==0){t.css({right:"",left:"0px"});i++}else{t.css({left:"",right:"0px"});i=0}setTimeout(function(){t.animate({width:"100%",opacity:"1.0"},n.options.animationSpeed,n.defs.easing,function(){if(o==n.options.strips-1)n.transitionEnd(n);o++})},100+r);r+=50});break;case"strip-up-down":case"strip-up-down-right":case"strip-up-down-left":n.addStrips();var r=0,i=0,o=0,s=e(".iview-strip",n.slider);if(t=="strip-up-down-left")s=e(".iview-strip",n.slider).reverse();s.each(function(){var t=e(this);if(i==0){t.css({bottom:"",top:"0px"});i++}else{t.css({top:"",bottom:"0px"});i=0}setTimeout(function(){t.animate({height:"100%",opacity:"1.0"},n.options.animationSpeed,n.defs.easing,function(){if(o==n.options.strips-1)n.transitionEnd(n);o++})},100+r);r+=50});break;case"left-curtain":case"right-curtain":case"top-curtain":case"bottom-curtain":if(t=="left-curtain"||t=="right-curtain")n.addStrips();else n.addStrips(true);var r=0,i=0,s=e(".iview-strip",n.slider);if(t=="right-curtain"||t=="bottom-curtain")s=e(".iview-strip",n.slider).reverse();s.each(function(){var s=e(this);var o=s.width();var u=s.height();if(t=="left-curtain"||t=="right-curtain")s.css({top:"0px",height:"100%",width:"0px"});else s.css({left:"0px",height:"0px",width:"100%"});setTimeout(function(){if(t=="left-curtain"||t=="right-curtain")s.animate({width:o,opacity:"1.0"},n.options.animationSpeed,n.defs.easing,function(){if(i==n.options.strips-1)n.transitionEnd(n);i++});else s.animate({height:u,opacity:"1.0"},n.options.animationSpeed,n.defs.easing,function(){if(i==n.options.strips-1)n.transitionEnd(n);i++})},100+r);r+=50});break;case"strip-up-right":case"strip-up-left":n.addStrips();var r=0,i=0,s=e(".iview-strip",n.slider);if(t=="strip-up-left")s=e(".iview-strip",n.slider).reverse();s.each(function(){var t=e(this);t.css({bottom:"0px"});setTimeout(function(){t.animate({height:"100%",opacity:"1.0"},n.options.animationSpeed,n.defs.easing,function(){if(i==n.options.strips-1)n.transitionEnd(n);i++})},100+r);r+=50});break;case"strip-left-fade":case"strip-right-fade":case"strip-top-fade":case"strip-bottom-fade":if(t=="strip-left-fade"||t=="strip-right-fade")n.addStrips();else n.addStrips(true);var r=0,i=0,s=e(".iview-strip",n.slider);if(t=="strip-right-fade"||t=="strip-bottom-fade")s=e(".iview-strip",n.slider).reverse();s.each(function(){var s=e(this);var o=s.width();var u=s.height();if(t=="strip-left-fade"||t=="strip-right-fade")s.css({top:"0px",height:"100%",width:o});else s.css({left:"0px",height:u,width:"100%"});setTimeout(function(){s.animate({opacity:"1.0"},n.options.animationSpeed*1.7,n.defs.easing,function(){if(i==n.options.strips-1)n.transitionEnd(n);i++})},100+r);r+=35});break;case"slide-in-up":case"slide-in-down":opts={strips:1};n.addStrips(false,opts);var u=e(".iview-strip:first",n.slider),a=0;if(t=="slide-in-up")a="-"+n.defs.height+"px";else a=n.defs.height+"px";u.css({top:a,height:"100%",width:n.defs.width});u.animate({top:"0px",opacity:1},n.options.animationSpeed*2,n.defs.easing,function(){n.transitionEnd(n)});break;case"zigzag-top":case"zigzag-bottom":case"zigzag-grow-top":case"zigzag-grow-bottom":case"zigzag-drop-top":case"zigzag-drop-bottom":n.addBlocks();var f=n.options.blockCols*n.options.blockRows,r=0,l=new Array,c=e(".iview-block",n.slider);for(var h=0;h=d;m--){l.push(e(c[m]))}}else{for(var m=d;m=0&&b=360){e.cleanTimer();e.goTo(false)}},setTimer:function(){var e=this;e.timer=setInterval(function(){e.timerCall(e)},e.defs.time/120)},cleanTimer:function(){var e=this;clearInterval(e.timer);e.timer=null},goTo:function(t){var n=this;if(n.defs&&n.defs.slide==n.defs.total-1){n.options.onLastSlide.call(this)}n.cleanTimer();n.iviewTimer.animate({opacity:0});n.options.onBeforeChange.call(this);if(!t){n.slider.css("background",'url("'+n.defs.image.data("iview:image")+'") no-repeat')}else{if(t=="prev"||t=="next"){n.slider.css("background",'url("'+n.defs.image.data("iview:image")+'") no-repeat')}}n.defs.slide++;if(n.defs.slide==n.defs.total){n.defs.slide=0;n.options.onSlideShowEnd.call(this)}if(n.defs.slide<0)n.defs.slide=n.defs.total-1;n.defs.image=n.slides.eq(n.defs.slide);if(n.options.controlNav){e(".iview-controlNav a.iview-control",n.sliderContent).removeClass("active");e(".iview-controlNav a.iview-control:eq("+n.defs.slide+")",n.sliderContent).addClass("active")}var i=n.options.fx;if(n.options.fx.toLowerCase()=="random"){var s=new Array("left-curtain","right-curtain","top-curtain","bottom-curtain","strip-down-right","strip-down-left","strip-up-right","strip-up-left","strip-up-down","strip-up-down-left","strip-left-right","strip-left-right-down","slide-in-right","slide-in-left","slide-in-up","slide-in-down","fade","block-random","block-fade","block-fade-reverse","block-expand","block-expand-reverse","block-expand-random","zigzag-top","zigzag-bottom","zigzag-grow-top","zigzag-grow-bottom","zigzag-drop-top","zigzag-drop-bottom","strip-left-fade","strip-right-fade","strip-top-fade","strip-bottom-fade","block-drop-random");i=s[Math.floor(Math.random()*(s.length+1))];if(i==r)i="fade";i=e.trim(i.toLowerCase())}if(n.options.fx.indexOf(",")!=-1){var s=n.options.fx.split(",");i=s[Math.floor(Math.random()*s.length)];if(i==r)i="fade";i=e.trim(i.toLowerCase())}if(n.defs.image.data("iview:transition")){var s=n.defs.image.data("iview:transition").split(",");i=s[Math.floor(Math.random()*s.length)];i=e.trim(i.toLowerCase())}n.defs.easing=n.defs.image.data("iview:easing")?n.defs.image.data("iview:easing"):n.options.easing;n.defs.lock=true;n.runTransition(i)},playSlider:function(){var e=this;if(e.timer==null&&e.defs.paused){e.iviewTimer.removeClass("paused").attr("title",e.options.pauseLabel);e.setTimer();e.defs.paused=false;e.options.onPlay.call(this)}},stopSlider:function(){var e=this;e.iviewTimer.addClass("paused").attr("title",e.options.playLabel);e.cleanTimer();e.defs.paused=true;e.options.onPause.call(this)},setTimerPosition:function(){var e=this,t=e.options.timerPosition.toLowerCase().split("-");for(var n=0;ne.event.special.swipe.scrollSupressionThreshold){t.preventDefault()}}var i=t.originalEvent.touches?t.originalEvent.touches[0]:t,s={time:(new Date).getTime(),coords:[i.pageX,i.pageY],origin:e(t.target)},o;n.bind(y,u).one(g,function(t){n.unbind(y,u);if(s&&o){if(o.time-s.timee.event.special.swipe.horizontalDistanceThreshold&&Math.abs(s.coords[1]-o.coords[1])o.coords[0]?"swipeleft":"swiperight")}}s=o=r})})}};e.each({swipeleft:"swipe",swiperight:"swipe"},function(t,n){e.event.special[t]={setup:function(){e(this).bind(n,e.noop)}}})})(jQuery,this) +/** + * jQuery iView Slider v2.0 + * + * @version: 2.0.1 - August 17, 2012 + * + * @author: Hemn Chawroka + * hemn@iprodev.com + * http://iprodev.com/ + * + */ (function ($, window, undefined) { + + var iView = function (el, options) { + //Get slider holder + var iv = this; + + iv.options = options; + + iv.sliderContent = el, iv.sliderInner = iv.sliderContent.html(); + + iv.sliderContent.html("
" + iv.sliderInner + "
"); + + //Get slider + iv.slider = $('.iviewSlider', iv.sliderContent); + iv.slider.css('position', 'relative'); + + //Necessary variables. + iv.defs = { + slide: 0, + total: 0, + image: '', + images: [], + width: iv.sliderContent.width(), + height: iv.sliderContent.height(), + timer: options.timer.toLowerCase(), + lock: false, + paused: (options.autoAdvance) ? false : true, + time: options.pauseTime, + easing: options.easing + }; + + //Disable slider text selection + iv.disableSelection(iv.slider[0]); + + //Find slides + iv.slides = iv.slider.children(); + iv.slides.each(function (i) { + var slide = $(this); + + //Find images & thumbnails + iv.defs.images.push(slide.data("iview:image")); + if (slide.data("iview:thumbnail")) iv.defs.images.push(slide.data("iview:thumbnail")); + slide.css('display', 'none'); + + //Find videos + if (slide.data("iview:type") == "video") { + var element = slide.children().eq(0), + video = $(''); + slide.append(video); + element.appendTo($('div.iview-video-container', video)); + video.css({ + width: iv.defs.width, + height: iv.defs.height, + top: '-' + iv.defs.height + 'px' + }).hide(); + slide.addClass('iview-video').css({ + 'cursor': 'pointer' + }); + } + + iv.defs.total++; + }).css({ + width: iv.defs.width, + height: iv.defs.height + }); + + //Set Preloader Element + iv.sliderContent.append('
'); + var iviewPreloader = $('#iview-preloader', iv.sliderContent); + var preloaderBar = $('div', iviewPreloader); + iviewPreloader.css({ + top: ((iv.defs.height / 2) - (iviewPreloader.height() / 2)) + 'px', + left: ((iv.defs.width / 2) - (iviewPreloader.width() / 2)) + 'px' + }); + + //Set Timer Element + iv.sliderContent.append('
'); + iv.iviewTimer = $('#iview-timer', iv.sliderContent); + iv.iviewTimer.hide(); + + //Find captions + $('.iview-caption', iv.slider).each(function (i) { + var caption = $(this); + caption.html('
' + caption.html() + '
'); + }); + + //If randomStart + options.startSlide = (options.randomStart) ? Math.floor(Math.random() * iv.defs.total) : options.startSlide; + + //Set startSlide + options.startSlide = (options.startSlide > 0 && options.startSlide >= iv.defs.total) ? iv.defs.total - 1 : options.startSlide; + iv.defs.slide = options.startSlide; + + //Set first image + iv.defs.image = iv.slides.eq(iv.defs.slide); + + //Set pauseTime + iv.defs.time = (iv.defs.image.data('iview:pausetime')) ? iv.defs.image.data('iview:pausetime') : options.pauseTime; + + //Set easing + iv.defs.easing = (iv.defs.image.data('iview:easing')) ? iv.defs.image.data('iview:easing') : options.easing; + + iv.pieDegree = 0; + var padding = options.timerPadding, + diameter = options.timerDiameter, + stroke = options.timerStroke; + + if (iv.defs.total > 1 && iv.defs.timer != "bar") { + //Start the Raphael + stroke = (iv.defs.timer == "360bar") ? options.timerStroke : 0; + var width = (diameter + (padding * 2) + (stroke * 2)), + height = width, + r = Raphael(iv.iviewTimer[0], width, height); + + iv.R = (diameter / 2); + + var param = { + stroke: options.timerBg, + "stroke-width": (stroke + (padding * 2)) + }, + param2 = { + stroke: options.timerColor, + "stroke-width": stroke, + "stroke-linecap": "round" + }, + param3 = { + fill: options.timerColor, + stroke: 'none', + "stroke-width": 0 + }, + bgParam = { + fill: options.timerBg, + stroke: 'none', + "stroke-width": 0 + }; + + // Custom Arc Attribute + r.customAttributes.arc = function (value, R) { + var total = 360, + alpha = 360 / total * value, + a = (90 - alpha) * Math.PI / 180, + cx = ((diameter / 2) + padding + stroke), + cy = ((diameter / 2) + padding + stroke), + x = cx + R * Math.cos(a), + y = cy - R * Math.sin(a), + path; + if (total == value) { + path = [["M", cx, cy - R], ["A", R, R, 0, 1, 1, 299.99, cy - R]]; + } else { + path = [["M", cx, cy - R], ["A", R, R, 0, +(alpha > 180), 1, x, y]]; + } + return { + path: path + }; + }; + + // Custom Segment Attribute + r.customAttributes.segment = function (angle, R) { + var a1 = -90; + R = R - 1; + angle = (a1 + angle); + var flag = (angle - a1) > 180, + x = ((diameter / 2) + padding), + y = ((diameter / 2) + padding); + a1 = (a1 % 360) * Math.PI / 180; + angle = (angle % 360) * Math.PI / 180; + return { + path: [["M", x, y], ["l", R * Math.cos(a1), R * Math.sin(a1)], ["A", R, R, 0, +flag, 1, x + R * Math.cos(angle), y + R * Math.sin(angle)], ["z"]] + }; + }; + + if (iv.defs.total > 1 && iv.defs.timer == "pie") { + r.circle(iv.R + padding, iv.R + padding, iv.R + padding - 1).attr(bgParam); + } + iv.timerBgPath = r.path().attr(param), iv.timerPath = r.path().attr(param2), iv.pieTimer = r.path().attr(param3); + } + + iv.barTimer = $('div', iv.iviewTimer); + + if (iv.defs.total > 1 && iv.defs.timer == "360bar") { + iv.timerBgPath.attr({ + arc: [359.9, iv.R] + }); + } + + //Set Timer Styles + if (iv.defs.timer == "bar") { + iv.iviewTimer.css({ + opacity: options.timerOpacity, + width: diameter, + height: stroke, + border: options.timerBarStroke + 'px ' + options.timerBarStrokeColor + ' ' + options.timerBarStrokeStyle, + padding: padding, + background: options.timerBg + }); + iv.barTimer.css({ + width: 0, + height: stroke, + background: options.timerColor, + 'float': 'left' + }); + } else { + iv.iviewTimer.css({ + opacity: options.timerOpacity, + width: width, + height: height + }); + } + + //Set Timer Position + iv.setTimerPosition(); + + // Run Preloader + new ImagePreload(iv.defs.images, function (i) { + var percent = (i * 10); + preloaderBar.stop().animate({ + width: percent + '%' + }); + }, function () { + preloaderBar.stop().animate({ + width: '100%' + }, function () { + iviewPreloader.remove(); + iv.startSlider(); + + //Trigger the onAfterLoad callback + options.onAfterLoad.call(this); + }); + }); + + //Touch navigation + iv.sliderContent.bind('swipeleft', function () { + if (iv.defs.lock) return false; + iv.cleanTimer(); + iv.goTo('next'); + }).bind('swiperight', function () { + if (iv.defs.lock) return false; + iv.cleanTimer(); + iv.defs.slide -= 2; + iv.goTo('prev'); + }); + + + + //Keyboard Navigation + if (options.keyboardNav) { + $(document).bind('keyup.iView', function (event) { + //Left + if (event.keyCode == '37') { + if (iv.defs.lock) return false; + iv.cleanTimer(); + iv.defs.slide -= 2; + iv.goTo('prev'); + } + //Right + if (event.keyCode == '39') { + if (iv.defs.lock) return false; + iv.cleanTimer(); + iv.goTo('next'); + } + }); + } + + //Play/Pause action + iv.iviewTimer.on('click', function () { + if (iv.iviewTimer.hasClass('paused')) { + iv.playSlider(); + } else { + iv.stopSlider(); + } + }); + + //Bind the stop action + iv.sliderContent.bind('iView:pause', function () { + iv.stopSlider(); + }); + + //Bind the start action + iv.sliderContent.bind('iView:play', function () { + iv.playSlider(); + }); + + //Bind the start action + iv.sliderContent.bind('iView:previous', function () { + if (iv.defs.lock) return false; + iv.cleanTimer(); + iv.defs.slide -= 2; + iv.goTo('prev'); + }); + + //Bind the start action + iv.sliderContent.bind('iView:next', function () { + if (iv.defs.lock) return false; + iv.cleanTimer(); + iv.goTo('next'); + }); + + //Bind the goSlide action + iv.sliderContent.bind('iView:goSlide', function (event, slide) { + if (iv.defs.lock || iv.defs.slide == slide) return false; + if ($(this).hasClass('active')) return false; + iv.cleanTimer(); + iv.slider.css('background', 'url("' + iv.defs.image.data('iview:image') + '") no-repeat'); + iv.defs.slide = slide - 1; + iv.goTo('control'); + }); + + //Bind the resize action + iv.sliderContent.bind('resize', function () { + + t = $(this), + tW = t.width(), + tH = t.height(), + width = iv.slider.width(), + height = iv.slider.height(); + + if(iv.defs.width != tW){ + var ratio = (tW / width), + newHeight = Math.round(iv.defs.height * ratio); + iv.slider.css({ + '-webkit-transform-origin' : '0 0', + '-moz-transform-origin' : '0 0', + '-o-transform-origin' : '0 0', + '-ms-transform-origin' : '0 0', + 'transform-origin' : '0 0', + '-webkit-transform' : 'scale('+ ratio +')', + '-moz-transform' : 'scale('+ ratio +')', + '-o-transform' : 'scale('+ ratio +')', + '-ms-transform' : 'scale('+ ratio +')', + 'transform' : 'scale('+ ratio +')' + }); + t.css({ height: newHeight }); + iv.defs.width = tW; + + //Set Timer Position + iv.setTimerPosition(); + } + }); + + //Bind video display + $('.iview-video', iv.slider).click(function(e){ + var t = $(this), + video = $('.iview-video-show', t); + if(!$(e.target).hasClass('iview-video-close') && !$(e.target).hasClass('iview-caption') && !$(e.target).parents().hasClass('iview-caption')){ + video.show().animate({ top: 0 }, 1000, 'easeOutBounce'); + iv.sliderContent.trigger('iView:pause'); + } + }); + + //Bind the video closer + $('.iview-video-close', iv.slider).click(function(){ + var video = $(this).parents('.iview-video-show'), + iframe = $('iframe', video), + src = iframe.attr('src'); + + iframe.removeAttr('src').attr('src',src); + + video.animate({ top: '-' + iv.defs.height + 'px' }, 1000, 'easeOutBounce', function(){ + video.hide(); + iv.sliderContent.trigger('iView:play'); + }); + }); + + }; + + //iView helper functions + iView.prototype = { + timer: null, + + //Start Slider + startSlider: function () { + var iv = this; + + var img = new Image(); + img.src = iv.slides.eq(0).data('iview:image'); + imgWidth = img.width; + if(imgWidth != iv.defs.width){ + iv.defs.width = imgWidth; + iv.sliderContent.trigger('resize'); + } + + iv.iviewTimer.show(); + + //Show slide + iv.slides.eq(iv.defs.slide).css('display', 'block'); + + //Set first background + iv.slider.css('background', 'url("' + iv.defs.image.data('iview:image') + '") no-repeat'); + + //Set initial caption + iv.setCaption(iv.options); + + iv.iviewTimer.addClass('paused').attr('title', iv.options.playLabel); + + if (iv.options.autoAdvance && iv.defs.total > 1) { + iv.iviewTimer.removeClass('paused').attr('title', iv.options.pauseLabel); + iv.setTimer(); + } + + //Add Direction nav + if (iv.options.directionNav) { + iv.sliderContent.append(''); + + //Animate Direction nav + $('.iview-directionNav', iv.sliderContent).css({ + opacity: iv.options.directionNavHoverOpacity + }); + iv.sliderContent.hover(function () { + $('.iview-directionNav', iv.sliderContent).stop().animate({ + opacity: 1 + }, 300); + }, function () { + $('.iview-directionNav', iv.sliderContent).stop().animate({ + opacity: iv.options.directionNavHoverOpacity + }, 300); + }); + + $('a.iview-prevNav', iv.sliderContent).on('click', function () { + if (iv.defs.lock) return false; + iv.cleanTimer(); + iv.defs.slide -= 2; + iv.goTo('prev'); + }); + + $('a.iview-nextNav', iv.sliderContent).on('click', function () { + if (iv.defs.lock) return false; + iv.cleanTimer(); + iv.goTo('next'); + }); + } + + //Add Control nav + if (iv.options.controlNav) { + var iviewControl = '
', + iviewTooltip = ''; + if (!iv.options.directionNav && iv.options.controlNavNextPrev) iviewControl += '' + iv.options.previousLabel + ''; + iviewControl += '
    '; + for (var i = 0; i < iv.defs.total; i++) { + var slide = iv.slides.eq(i); + iviewControl += '
  • '; + if (iv.options.controlNavThumbs) { + var thumb = (slide.data('iview:thumbnail')) ? slide.data('iview:thumbnail') : slide.data('iview:image'); + iviewControl += ''; + } else { + var thumb = (slide.data('iview:thumbnail')) ? slide.data('iview:thumbnail') : slide.data('iview:image'); + iviewControl += '' + (i + 1) + ''; + if (iv.options.controlNavTooltip) iviewTooltip += '
    '; + } + iviewControl += '
  • '; + } + iviewControl += '
'; + if (!iv.options.directionNav && iv.options.controlNavNextPrev) iviewControl += '' + iv.options.nextLabel + ''; + iviewControl += '
'; + + if (!iv.options.controlNavThumbs && iv.options.controlNavTooltip) iviewControl += '
' + iviewTooltip + '
'; + + iv.sliderContent.append(iviewControl); + + //Set initial active link + $('.iview-controlNav a.iview-control:eq(' + iv.defs.slide + ')', iv.sliderContent).addClass('active'); + + $('a.iview-controlPrevNav', iv.sliderContent).on('click', function () { + if (iv.defs.lock) return false; + iv.cleanTimer(); + iv.defs.slide -= 2; + iv.goTo('prev'); + }); + + $('a.iview-controlNextNav', iv.sliderContent).on('click', function () { + if (iv.defs.lock) return false; + iv.cleanTimer(); + iv.goTo('next'); + }); + + $('.iview-controlNav a.iview-control', iv.sliderContent).on('click', function () { + if (iv.defs.lock) return false; + if ($(this).hasClass('active')) return false; + iv.cleanTimer(); + iv.slider.css('background', 'url("' + iv.defs.image.data('iview:image') + '") no-repeat'); + iv.defs.slide = $(this).attr('rel') - 1; + iv.goTo('control'); + }); + + //Animate Control nav + $('.iview-controlNav', iv.sliderContent).css({ + opacity: iv.options.controlNavHoverOpacity + }); + iv.sliderContent.hover(function () { + $('.iview-controlNav', iv.sliderContent).stop().animate({ + opacity: 1 + }, 300); + iv.sliderContent.addClass('iview-hover'); + }, function () { + $('.iview-controlNav', iv.sliderContent).stop().animate({ + opacity: iv.options.controlNavHoverOpacity + }, 300); + iv.sliderContent.removeClass('iview-hover'); + }); + + //Show Tooltip + var tooltipTimer = null; + + $('.iview-controlNav a.iview-control', iv.sliderContent).hover(function (e) { + var t = $(this), + i = t.attr('rel'), + tooltip = $('#iview-tooltip', iv.sliderContent), + holder = $('div.holder', tooltip), + x = t.offset().left - iv.sliderContent.offset().left - (tooltip.outerWidth() / 2) + iv.options.tooltipX, + y = t.offset().top - iv.sliderContent.offset().top - tooltip.outerHeight() + iv.options.tooltipY, + imD = $('div[rel=' + i + ']') + scrollLeft = (i * imD.width()); + + tooltip.stop().animate({ + left: x, + top: y, + opacity: 1 + }, 300); + //tooltip.css({ opacity: 1 }); + if (tooltip.not(':visible')) tooltip.fadeIn(300); + holder.stop().animate({ + scrollLeft: scrollLeft + }, 300); + + clearTimeout(tooltipTimer); + + }, function (e) { + var tooltip = $('#iview-tooltip', iv.sliderContent); + tooltipTimer = setTimeout(function () { + tooltip.animate({ + opacity: 0 + }, 300, function () { + tooltip.hide(); + }); + }, 200); + }); + } + + //Bind hover setting + iv.sliderContent.bind('mouseover.iView mousemove.iView', function () { + //Clear the timer + if (iv.options.pauseOnHover && !iv.defs.paused) iv.cleanTimer(); + + iv.sliderContent.addClass('iview-hover'); + }).bind('mouseout.iView', function () { + //Restart the timer + if (iv.options.pauseOnHover && !iv.defs.paused && iv.timer == null && iv.pieDegree <= 359 && iv.options.autoAdvance) iv.setTimer(); + + iv.sliderContent.removeClass('iview-hover'); + }); + }, + + // setCaption function + setCaption: function () { + var iv = this, + slide = iv.slides.eq(iv.defs.slide), + captions = $('.iview-caption', slide), + timeEx = 0; + captions.each(function (i) { + var caption = $(this), + fx = (caption.data('transition')) ? $.trim(caption.data('transition').toLowerCase()) : "fade", + speed = (caption.data('speed')) ? caption.data('speed') : iv.options.captionSpeed, + easing = (caption.data('easing')) ? caption.data('easing') : iv.options.captionEasing, + x = (caption.data('x')!="undefined") ? caption.data('x') : "center", + y = (caption.data('y')!="undefined") ? caption.data('y') : "center", + w = (caption.data('width')) ? caption.data('width') : caption.width(), + h = (caption.data('height')) ? caption.data('height') : caption.height(), + oW = caption.outerWidth(), + oH = caption.outerHeight(); + + if(x == "center") x = ((iv.defs.width/2) - (oW/2)); + if(y == "center") y = ((iv.defs.height/2) - (oH/2)); + + var captionContain = $('.caption-contain', caption); + + caption.css({ + opacity: 0 + }); + captionContain.css({ + opacity: 0, + position: 'relative', + width: w, + height: h + }); + + switch (fx) { + case "wipedown": + caption.css({ + top: (y - h), + left: x + }); + captionContain.css({ + top: (h + (h * 3)), + left: 0 + }); + break; + case "wipeup": + caption.css({ + top: (y + h), + left: x + }); + captionContain.css({ + top: (h - (h * 3)), + left: 0 + }); + break; + case "wiperight": + caption.css({ + top: y, + left: (x - w) + }); + captionContain.css({ + top: 0, + left: (w + (w * 2)) + }); + break; + case "wipeleft": + caption.css({ + top: y, + left: (x + w) + }); + captionContain.css({ + top: 0, + left: (w - (w * 2)) + }); + break; + case "fade": + caption.css({ + top: y, + left: x + }); + captionContain.css({ + top: 0, + left: 0 + }); + break; + case "expanddown": + caption.css({ + top: y, + left: x, + height: 0 + }); + captionContain.css({ + top: (h + (h * 3)), + left: 0 + }); + break; + case "expandup": + caption.css({ + top: (y + h), + left: x, + height: 0 + }); + captionContain.css({ + top: (h - (h * 3)), + left: 0 + }); + break; + case "expandright": + caption.css({ + top: y, + left: x, + width: 0 + }); + captionContain.css({ + top: 0, + left: (w + (w * 2)) + }); + break; + case "expandleft": + caption.css({ + top: y, + left: (x + w), + width: 0 + }); + captionContain.css({ + top: 0, + left: (w - (w * 2)) + }); + break; + } + + setTimeout(function () { + caption.animate({ + opacity: iv.options.captionOpacity, + top: y, + left: x, + width: w, + height: h + }, speed, easing, function () {}); + }, timeEx); + setTimeout(function () { + captionContain.animate({ + opacity: iv.options.captionOpacity, + top: 0, + left: 0 + }, speed, easing); + }, (timeEx + 100)); + timeEx += 250; + }); + }, + + //Process the timer + processTimer: function () { + var iv = this; + if (iv.defs.timer == "360bar") { + var degree = (iv.pieDegree == 0) ? 0 : iv.pieDegree + .9; + iv.timerPath.attr({ + arc: [degree, iv.R] + }); + } else if (iv.defs.timer == "pie") { + var degree = (iv.pieDegree == 0) ? 0 : iv.pieDegree + .9; + iv.pieTimer.attr({ + segment: [degree, iv.R] + }); + } else { + iv.barTimer.css({ + width: ((iv.pieDegree / 360) * 100) + '%' + }); + } + iv.pieDegree += 3; + }, + + //When Animation finishes + transitionEnd: function (iv) { + //Trigger the onAfterChange callback + iv.options.onAfterChange.call(this); + + //Lock the slider + iv.defs.lock = false; + + //Hide slider slides + iv.slides.css('display', 'none'); + + //Diplay the current slide + iv.slides.eq(iv.defs.slide).show(); + + iv.slider.css('background', 'url("' + iv.defs.image.data('iview:image') + '") no-repeat'); + + // Remove any strips and blocks from last transition + $('.iview-strip, .iview-block', iv.slider).remove(); + + //Set slide pauseTime + iv.defs.time = (iv.defs.image.data('iview:pausetime')) ? iv.defs.image.data('iview:pausetime') : iv.options.pauseTime; + + //Process timer + iv.iviewTimer.animate({ + opacity: iv.options.timerOpacity + }); + iv.pieDegree = 0; + iv.processTimer(); + + //Set caption + iv.setCaption(iv.options); + + //Restart the timer + if (iv.timer == null && !iv.defs.paused) iv.timer = setInterval(function () { + iv.timerCall(iv); + }, (iv.defs.time / 120)); + }, + + // Add strips + addStrips: function (vertical, opts) { + var iv = this; + opts = (opts) ? opts : iv.options; + for (var i = 0; i < opts.strips; i++) { + var stripWidth = Math.round(iv.slider.width() / opts.strips), + stripHeight = Math.round(iv.slider.height() / opts.strips), + bgPosition = '-' + ((stripWidth + (i * stripWidth)) - stripWidth) + 'px 0%', + top = ((vertical) ? (stripHeight * i) + 'px' : '0px'), + left = ((vertical) ? '0px' : (stripWidth * i) + 'px'); + if (vertical) bgPosition = '0% -' + ((stripHeight + (i * stripHeight)) - stripHeight) + 'px'; + + if (i == opts.strips - 1) { + var width = ((vertical) ? '0px' : (iv.slider.width() - (stripWidth * i)) + 'px'), + height = ((vertical) ? (iv.slider.height() - (stripHeight * i)) + 'px' : '0px'); + } else { + var width = ((vertical) ? '0px' : stripWidth + 'px'), + height = ((vertical) ? stripHeight + 'px' : '0px'); + } + + var strip = $('
').css({ + width: width, + height: height, + top: top, + left: left, + background: 'url("' + iv.defs.image.data('iview:image') + '") no-repeat ' + bgPosition, + opacity: 0 + }); + + iv.slider.append(strip); + } + }, + + // Add blocks + addBlocks: function () { + var iv = this, + blockWidth = Math.round(iv.slider.width() / iv.options.blockCols), + blockHeight = Math.round(iv.slider.height() / iv.options.blockRows); + + for (var rows = 0; rows < iv.options.blockRows; rows++) { + for (var columns = 0; columns < iv.options.blockCols; columns++) { + var top = (rows * blockHeight) + 'px', + left = (columns * blockWidth) + 'px', + width = blockWidth + 'px', + height = blockHeight + 'px', + bgPosition = '-' + ((blockWidth + (columns * blockWidth)) - blockWidth) + 'px -' + ((blockHeight + (rows * blockHeight)) - blockHeight) + 'px'; + + if (columns == iv.options.blockCols - 1) width = (iv.slider.width() - (blockWidth * columns)) + 'px'; + + var block = $('
').css({ + width: blockWidth + 'px', + height: blockHeight + 'px', + top: (rows * blockHeight) + 'px', + left: (columns * blockWidth) + 'px', + background: 'url("' + iv.defs.image.data('iview:image') + '") no-repeat ' + bgPosition, + opacity: 0 + }); + + iv.slider.append(block); + } + } + }, + + runTransition: function (fx) { + var iv = this; + + switch (fx) { + case 'strip-up-right': + case 'strip-up-left': + iv.addStrips(); + var timeDelay = 0; + i = 0, strips = $('.iview-strip', iv.slider); + if (fx == 'strip-up-left') strips = $('.iview-strip', iv.slider).reverse(); + + strips.each(function () { + var strip = $(this); + strip.css({ + top: '', + bottom: '0px' + }); + + setTimeout(function () { + strip.animate({ + height: '100%', + opacity: '1.0' + }, iv.options.animationSpeed, iv.defs.easing, function () { + if (i == iv.options.strips - 1) iv.transitionEnd(iv); + i++; + }); + }, (100 + timeDelay)); + + timeDelay += 50; + }); + break; + case 'strip-down': + case 'strip-down-right': + case 'strip-down-left': + iv.addStrips(); + var timeDelay = 0, + i = 0, + strips = $('.iview-strip', iv.slider); + if (fx == 'strip-down-left') strips = $('.iview-strip', iv.slider).reverse(); + + strips.each(function () { + var strip = $(this); + strip.css({ + bottom: '', + top: '0px' + }); + + setTimeout(function () { + strip.animate({ + height: '100%', + opacity: '1.0' + }, iv.options.animationSpeed, iv.defs.easing, function () { + if (i == iv.options.strips - 1) iv.transitionEnd(iv); + i++; + }); + }, (100 + timeDelay)); + timeDelay += 50; + }); + break; + case 'strip-left-right': + case 'strip-left-right-up': + case 'strip-left-right-down': + iv.addStrips(true); + var timeDelay = 0, + i = 0, + v = 0, + strips = $('.iview-strip', iv.slider); + if (fx == 'strip-left-right-down') strips = $('.iview-strip', iv.slider).reverse(); + + strips.each(function () { + var strip = $(this); + if (i == 0) { + strip.css({ + right: '', + left: '0px' + }); + i++; + } else { + strip.css({ + left: '', + right: '0px' + }); + i = 0; + } + + setTimeout(function () { + strip.animate({ + width: '100%', + opacity: '1.0' + }, iv.options.animationSpeed, iv.defs.easing, function () { + if (v == iv.options.strips - 1) iv.transitionEnd(iv); + v++; + }); + }, (100 + timeDelay)); + timeDelay += 50; + }); + break; + case 'strip-up-down': + case 'strip-up-down-right': + case 'strip-up-down-left': + iv.addStrips(); + var timeDelay = 0, + i = 0, + v = 0, + strips = $('.iview-strip', iv.slider); + if (fx == 'strip-up-down-left') strips = $('.iview-strip', iv.slider).reverse(); + + strips.each(function () { + var strip = $(this); + if (i == 0) { + strip.css({ + bottom: '', + top: '0px' + }); + i++; + } else { + strip.css({ + top: '', + bottom: '0px' + }); + i = 0; + } + + setTimeout(function () { + strip.animate({ + height: '100%', + opacity: '1.0' + }, iv.options.animationSpeed, iv.defs.easing, function () { + if (v == iv.options.strips - 1) iv.transitionEnd(iv); + v++; + }); + }, (100 + timeDelay)); + timeDelay += 50; + }); + break; + case 'left-curtain': + case 'right-curtain': + case 'top-curtain': + case 'bottom-curtain': + if (fx == 'left-curtain' || fx == 'right-curtain') iv.addStrips(); + else iv.addStrips(true); + var timeDelay = 0, + i = 0, + strips = $('.iview-strip', iv.slider); + + if (fx == 'right-curtain' || fx == 'bottom-curtain') strips = $('.iview-strip', iv.slider).reverse(); + + strips.each(function () { + var strip = $(this); + var width = strip.width(); + var height = strip.height(); + if (fx == 'left-curtain' || fx == 'right-curtain') strip.css({ + top: '0px', + height: '100%', + width: '0px' + }); + else strip.css({ + left: '0px', + height: '0px', + width: '100%' + }); + setTimeout(function () { + if (fx == 'left-curtain' || fx == 'right-curtain') strip.animate({ + width: width, + opacity: '1.0' + }, iv.options.animationSpeed, iv.defs.easing, function () { + if (i == iv.options.strips - 1) iv.transitionEnd(iv); + i++; + }); + else strip.animate({ + height: height, + opacity: '1.0' + }, iv.options.animationSpeed, iv.defs.easing, function () { + if (i == iv.options.strips - 1) iv.transitionEnd(iv); + i++; + }); + }, (100 + timeDelay)); + timeDelay += 50; + }); + break; + case 'strip-up-right': + case 'strip-up-left': + iv.addStrips(); + var timeDelay = 0, + i = 0, + strips = $('.iview-strip', iv.slider); + if (fx == 'strip-up-left') strips = $('.iview-strip', iv.slider).reverse(); + + strips.each(function () { + var strip = $(this); + strip.css({ + 'bottom': '0px' + }); + setTimeout(function () { + strip.animate({ + height: '100%', + opacity: '1.0' + }, iv.options.animationSpeed, iv.defs.easing, function () { + if (i == iv.options.strips - 1) iv.transitionEnd(iv); + i++; + }); + }, (100 + timeDelay)); + timeDelay += 50; + }); + break; + case 'strip-left-fade': + case 'strip-right-fade': + case 'strip-top-fade': + case 'strip-bottom-fade': + if (fx == 'strip-left-fade' || fx == 'strip-right-fade') iv.addStrips(); + else iv.addStrips(true); + var timeDelay = 0, + i = 0, + strips = $('.iview-strip', iv.slider); + + if (fx == 'strip-right-fade' || fx == 'strip-bottom-fade') strips = $('.iview-strip', iv.slider).reverse(); + + strips.each(function () { + var strip = $(this); + var width = strip.width(); + var height = strip.height(); + if (fx == 'strip-left-fade' || fx == 'strip-right-fade') strip.css({ + top: '0px', + height: '100%', + width: width + }); + else strip.css({ + left: '0px', + height: height, + width: '100%' + }); + setTimeout(function () { + strip.animate({ + opacity: '1.0' + }, iv.options.animationSpeed * 1.7, iv.defs.easing, function () { + if (i == iv.options.strips - 1) iv.transitionEnd(iv); + i++; + }); + }, (100 + timeDelay)); + timeDelay += 35; + }); + break; + case 'slide-in-up': + case 'slide-in-down': + opts = { + strips: 1 + }; + iv.addStrips(false, opts); + + var strip = $('.iview-strip:first', iv.slider), + top = 0; + + if (fx == 'slide-in-up') top = '-' + iv.defs.height + 'px'; + else top = iv.defs.height + 'px'; + + strip.css({ + top: top, + 'height': '100%', + 'width': iv.defs.width + }); + + strip.animate({ + 'top': '0px', + opacity: 1 + }, (iv.options.animationSpeed * 2), iv.defs.easing, function () { + iv.transitionEnd(iv); + }); + break; + case 'zigzag-top': + case 'zigzag-bottom': + case 'zigzag-grow-top': + case 'zigzag-grow-bottom': + case 'zigzag-drop-top': + case 'zigzag-drop-bottom': + iv.addBlocks(); + + var totalBlocks = (iv.options.blockCols * iv.options.blockRows), + timeDelay = 0, + blockToArr = new Array(), + blocks = $('.iview-block', iv.slider); + + for (var rows = 0; rows < iv.options.blockRows; rows++) { + var odd = (rows % 2), + start = (rows * iv.options.blockCols), + end = ((rows + 1) * iv.options.blockCols); + if (odd == 1) { + for (var columns = end - 1; columns >= start; columns--) { + blockToArr.push($(blocks[columns])); + } + } else { + for (var columns = start; columns < end; columns++) { + blockToArr.push($(blocks[columns])); + } + } + } + + if (fx == 'zigzag-bottom' || fx == 'zigzag-grow-bottom' || fx == 'zigzag-drop-bottom') blockToArr.reverse(); + + // Run animation + blocks.each(function (i) { + var block = $(blockToArr[i]), + h = block.height(), + w = block.width(), + top = block.css('top'); + + if (fx == 'zigzag-grow-top' || fx == 'zigzag-grow-bottom') block.width(0).height(0); + else if (fx == 'zigzag-drop-top' || fx == 'zigzag-drop-bottom') block.css({ + top: '-=50' + }); + + setTimeout(function () { + if (fx == 'zigzag-grow-top' || fx == 'zigzag-grow-bottom') block.animate({ + opacity: '1', + height: h, + width: w + }, iv.options.animationSpeed, iv.defs.easing, function () { + if (i == totalBlocks - 1) iv.transitionEnd(iv); + }); + else if (fx == 'zigzag-drop-top' || fx == 'zigzag-drop-bottom') block.animate({ + top: top, + opacity: '1' + }, iv.options.animationSpeed, iv.defs.easing, function () { + if (i == totalBlocks - 1) iv.transitionEnd(iv); + }); + else block.animate({ + opacity: '1' + }, (iv.options.animationSpeed * 2), 'easeInOutExpo', function () { + if (i == totalBlocks - 1) iv.transitionEnd(iv); + }); + }, (100 + timeDelay)); + timeDelay += 20; + }); + break; + case 'block-fade': + case 'block-fade-reverse': + case 'block-expand': + case 'block-expand-reverse': + iv.addBlocks(); + + var totalBlocks = (iv.options.blockCols * iv.options.blockRows), + i = 0, + timeDelay = 0; + + // Split blocks into array + var rowIndex = 0; + var colIndex = 0; + var blockToArr = new Array(); + blockToArr[rowIndex] = new Array(); + var blocks = $('.iview-block', iv.slider); + if (fx == 'block-fade-reverse' || fx == 'block-expand-reverse') { + blocks = $('.iview-block', iv.slider).reverse(); + } + blocks.each(function () { + blockToArr[rowIndex][colIndex] = $(this); + colIndex++; + if (colIndex == iv.options.blockCols) { + rowIndex++; + colIndex = 0; + blockToArr[rowIndex] = new Array(); + } + }); + + // Run animation + for (var columns = 0; columns < (iv.options.blockCols * 2); columns++) { + var Col = columns; + for (var rows = 0; rows < iv.options.blockRows; rows++) { + if (Col >= 0 && Col < iv.options.blockCols) { + (function () { + var block = $(blockToArr[rows][Col]); + var w = block.width(); + var h = block.height(); + if (fx == 'block-expand' || fx == 'block-expand-reverse') { + block.width(0).height(0); + } + + setTimeout(function () { + block.animate({ + opacity: '1', + width: w, + height: h + }, iv.options.animationSpeed / 1.3, iv.defs.easing, function () { + if (i == totalBlocks - 1) iv.transitionEnd(iv); + i++; + }); + }, (100 + timeDelay)); + + })(); + } + Col--; + } + timeDelay += 100; + } + break; + case 'block-random': + case 'block-expand-random': + case 'block-drop-random': + iv.addBlocks(); + + var totalBlocks = (iv.options.blockCols * iv.options.blockRows), + timeDelay = 0; + + var blocks = iv.shuffle($('.iview-block', iv.slider)); + blocks.each(function (i) { + var block = $(this), + h = block.height(), + w = block.width(), + top = block.css('top'); + if (fx == 'block-expand-random') block.width(0).height(0); + if (fx == 'block-drop-random') block.css({ + top: '-=50' + }); + + setTimeout(function () { + block.animate({ + top: top, + opacity: '1', + height: h, + width: w + }, iv.options.animationSpeed, iv.defs.easing, function () { + if (i == totalBlocks - 1) iv.transitionEnd(iv); + }); + }, (100 + timeDelay)); + + timeDelay += 20; + }); + break; + case 'slide-in-right': + case 'slide-in-left': + case 'fade': + default: + opts = { + strips: 1 + }; + iv.addStrips(false, opts); + + var strip = $('.iview-strip:first', iv.slider); + strip.css({ + 'height': '100%', + 'width': iv.defs.width + }); + if (fx == 'slide-in-right') strip.css({ + 'height': '100%', + 'width': iv.defs.width, + 'left': iv.defs.width + 'px', + 'right': '' + }); + else if (fx == 'slide-in-left') strip.css({ + 'left': '-' + iv.defs.width + 'px' + }); + + strip.animate({ + left: '0px', + opacity: 1 + }, (iv.options.animationSpeed * 2), iv.defs.easing, function () { + iv.transitionEnd(iv); + }); + break; + } + }, + + // Shuffle an array + shuffle: function (oldArray) { + var newArray = oldArray.slice(); + var len = newArray.length; + var i = len; + while (i--) { + var p = parseInt(Math.random() * len); + var t = newArray[i]; + newArray[i] = newArray[p]; + newArray[p] = t; + } + return newArray; + }, + + // Timer interval caller + timerCall: function (iv) { + iv.processTimer(); + if (iv.pieDegree >= 360) { + iv.cleanTimer(); + iv.goTo(false); + } + }, + + //Set the timer function + setTimer: function () { + var iv = this; + iv.timer = setInterval(function () { + iv.timerCall(iv); + }, (iv.defs.time / 120)); + }, + + //Clean the timer function + cleanTimer: function () { + var iv = this; + clearInterval(iv.timer); + iv.timer = null; + }, + + + // goTo function + goTo: function (action) { + var iv = this; + //Trigger the onLastSlide callback + if (iv.defs && (iv.defs.slide == iv.defs.total - 1)) { + iv.options.onLastSlide.call(this); + } + + iv.cleanTimer(); + + iv.iviewTimer.animate({ + opacity: 0 + }); + + //Trigger the onBeforeChange callback + iv.options.onBeforeChange.call(this); + + //Set current background before change + if (!action) { + iv.slider.css('background', 'url("' + iv.defs.image.data('iview:image') + '") no-repeat'); + } else { + if (action == 'prev' || action == 'next') { + iv.slider.css('background', 'url("' + iv.defs.image.data('iview:image') + '") no-repeat'); + } + } + iv.defs.slide++; + + //Trigger the onSlideShowEnd callback + if (iv.defs.slide == iv.defs.total) { + iv.defs.slide = 0; + iv.options.onSlideShowEnd.call(this); + } + if (iv.defs.slide < 0) iv.defs.slide = (iv.defs.total - 1); + + //Set iv.defs.image + iv.defs.image = iv.slides.eq(iv.defs.slide); + + //Set active links + if (iv.options.controlNav) { + $('.iview-controlNav a.iview-control', iv.sliderContent).removeClass('active'); + $('.iview-controlNav a.iview-control:eq(' + iv.defs.slide + ')', iv.sliderContent).addClass('active'); + } + + var fx = iv.options.fx; + + //Generate random transition + if (iv.options.fx.toLowerCase() == 'random') { + var transitions = new Array('left-curtain', 'right-curtain', 'top-curtain', 'bottom-curtain', 'strip-down-right', 'strip-down-left', 'strip-up-right', 'strip-up-left', 'strip-up-down', 'strip-up-down-left', 'strip-left-right', 'strip-left-right-down', 'slide-in-right', 'slide-in-left', 'slide-in-up', 'slide-in-down', 'fade', 'block-random', 'block-fade', 'block-fade-reverse', 'block-expand', 'block-expand-reverse', 'block-expand-random', 'zigzag-top', 'zigzag-bottom', 'zigzag-grow-top', 'zigzag-grow-bottom', 'zigzag-drop-top', 'zigzag-drop-bottom', 'strip-left-fade', 'strip-right-fade', 'strip-top-fade', 'strip-bottom-fade', 'block-drop-random'); + fx = transitions[Math.floor(Math.random() * (transitions.length + 1))]; + if (fx == undefined) fx = 'fade'; + fx = $.trim(fx.toLowerCase()); + } + + //Run random transition from specified set (eg: effect:'strip-left-fade,right-curtain') + if (iv.options.fx.indexOf(',') != -1) { + var transitions = iv.options.fx.split(','); + fx = transitions[Math.floor(Math.random() * (transitions.length))]; + if (fx == undefined) fx = 'fade'; + fx = $.trim(fx.toLowerCase()); + } + + //Custom transition as defined by "data-iview:transition" attribute + if (iv.defs.image.data('iview:transition')) { + var transitions = iv.defs.image.data('iview:transition').split(','); + fx = transitions[Math.floor(Math.random() * (transitions.length))]; + fx = $.trim(fx.toLowerCase()); + } + + //Set slide easing + iv.defs.easing = (iv.defs.image.data('iview:easing')) ? iv.defs.image.data('iview:easing') : iv.options.easing; + + //Start Transition + iv.defs.lock = true; + iv.runTransition(fx); + }, + + playSlider: function () { + var iv = this; + if (iv.timer == null && iv.defs.paused) { + iv.iviewTimer.removeClass('paused').attr('title', iv.options.pauseLabel); + iv.setTimer(); + iv.defs.paused = false; + + //Trigger the onPlay callback + iv.options.onPlay.call(this); + } + }, + + stopSlider: function () { + var iv = this; + iv.iviewTimer.addClass('paused').attr('title', iv.options.playLabel); + iv.cleanTimer(); + iv.defs.paused = true; + + //Trigger the onPause callback + iv.options.onPause.call(this); + }, + + //Set Timer Position function + setTimerPosition: function(){ + var iv = this, + position = iv.options.timerPosition.toLowerCase().split('-'); + for (var i = 0; i < position.length; i++) { + if (position[i] == 'top') { + iv.iviewTimer.css({ + top: iv.options.timerY + 'px', + bottom: '' + }); + } else if (position[i] == 'middle') { + iv.iviewTimer.css({ + top: (iv.options.timerY + (iv.defs.height / 2) - (iv.options.timerDiameter / 2)) + 'px', + bottom: '' + }); + } else if (position[i] == 'bottom') { + iv.iviewTimer.css({ + bottom: iv.options.timerY + 'px', + top: '' + }); + } else if (position[i] == 'left') { + iv.iviewTimer.css({ + left: iv.options.timerX + 'px', + right: '' + }); + } else if (position[i] == 'center') { + iv.iviewTimer.css({ + left: (iv.options.timerX + (iv.defs.width / 2) - (iv.options.timerDiameter / 2)) + 'px', + right: '' + }); + } else if (position[i] == 'right') { + iv.iviewTimer.css({ + right: iv.options.timerX + 'px', + left: '' + }); + } + } + }, + + disableSelection: function (target) { + if (typeof target.onselectstart != "undefined") target.onselectstart = function () { + return false; + }; + else if (typeof target.style.MozUserSelect != "undefined") target.style.MozUserSelect = "none"; + else if (typeof target.style.webkitUserSelect != "undefined") target.style.webkitUserSelect = "none"; + else if (typeof target.style.userSelect != "undefined") target.style.userSelect = "none"; + else target.onmousedown = function () { + return false; + }; + target.unselectable = "on"; + }, + + //touch + isTouch: function () { + return !!('ontouchstart' in window); + } + }; + + //Image Preloader Function + var ImagePreload = function (p_aImages, p_pfnPercent, p_pfnFinished) { + this.m_pfnPercent = p_pfnPercent; + this.m_pfnFinished = p_pfnFinished; + this.m_nLoaded = 0; + this.m_nProcessed = 0; + this.m_aImages = new Array; + this.m_nICount = p_aImages.length; + for (var i = 0; i < p_aImages.length; i++) this.Preload(p_aImages[i]) + }; + + ImagePreload.prototype = { + Preload: function (p_oImage) { + var oImage = new Image; + this.m_aImages.push(oImage); + oImage.onload = ImagePreload.prototype.OnLoad; + oImage.onerror = ImagePreload.prototype.OnError; + oImage.onabort = ImagePreload.prototype.OnAbort; + oImage.oImagePreload = this; + oImage.bLoaded = false; + oImage.source = p_oImage; + oImage.src = p_oImage + }, + OnComplete: function () { + this.m_nProcessed++; + if (this.m_nProcessed == this.m_nICount) this.m_pfnFinished(); + else this.m_pfnPercent(Math.round((this.m_nProcessed / this.m_nICount) * 10)) + }, + OnLoad: function () { + this.bLoaded = true; + this.oImagePreload.m_nLoaded++; + this.oImagePreload.OnComplete() + }, + OnError: function () { + this.bError = true; + this.oImagePreload.OnComplete() + }, + OnAbort: function () { + this.bAbort = true; + this.oImagePreload.OnComplete() + } + } + + + + // Begin the iView plugin + $.fn.iView = function (options) { + + // Default options. Play carefully. + options = jQuery.extend({ + fx: 'random', + easing: 'easeOutQuad', + strips: 20, + blockCols: 10, + blockRows: 5, + animationSpeed: 500, + pauseTime: 5000, + startSlide: 0, + directionNav: true, + directionNavHoverOpacity: 0.6, + controlNav: false, + controlNavNextPrev: true, + controlNavHoverOpacity: 0.6, + controlNavThumbs: false, + controlNavTooltip: true, + captionSpeed: 500, + captionEasing: 'easeInOutSine', + captionOpacity: 1, + autoAdvance: true, + keyboardNav: true, + touchNav: true, + pauseOnHover: false, + nextLabel: "Next", + previousLabel: "Previous", + playLabel: "Play", + pauseLabel: "Pause", + closeLabel: "Close", + randomStart: false, + timer: 'Pie', + timerBg: '#000', + timerColor: '#EEE', + timerOpacity: 0.5, + timerDiameter: 30, + timerPadding: 4, + timerStroke: 3, + timerBarStroke: 1, + timerBarStrokeColor: '#EEE', + timerBarStrokeStyle: 'solid', + timerPosition: 'top-right', + timerX: 10, + timerY: 10, + tooltipX: 5, + tooltipY: -5, + onBeforeChange: function () {}, + onAfterChange: function () {}, + onAfterLoad: function () {}, + onLastSlide: function () {}, + onSlideShowEnd: function () {}, + onPause: function () {}, + onPlay: function () {} + }, options); + + $(this).each(function () { + var el = $(this); + new iView(el, options); + }); + + }; + + $.fn.reverse = [].reverse; + + var elems = $([]), + jq_resize = $.resize = $.extend($.resize, {}), + timeout_id, str_setTimeout = "setTimeout", + str_resize = "resize", + str_data = str_resize + "-special-event", + str_delay = "delay", + str_throttle = "throttleWindow"; + jq_resize[str_delay] = 250; + jq_resize[str_throttle] = true; + $.event.special[str_resize] = { + setup: function () { + if (!jq_resize[str_throttle] && this[str_setTimeout]) { + return false + } + var elem = $(this); + elems = elems.add(elem); + $.data(this, str_data, { + w: elem.width(), + h: elem.height() + }); + if (elems.length === 1) { + loopy() + } + }, + teardown: function () { + if (!jq_resize[str_throttle] && this[str_setTimeout]) { + return false + } + var elem = $(this); + elems = elems.not(elem); + elem.removeData(str_data); + if (!elems.length) { + clearTimeout(timeout_id) + } + }, + add: function (handleObj) { + if (!jq_resize[str_throttle] && this[str_setTimeout]) { + return false + } + var old_handler; + + function new_handler(e, w, h) { + var elem = $(this), + data = $.data(this, str_data); + data.w = w !== undefined ? w : elem.width(); + data.h = h !== undefined ? h : elem.height(); + old_handler.apply(this, arguments) + } + if ($.isFunction(handleObj)) { + old_handler = handleObj; + return new_handler + } else { + old_handler = handleObj.handler; + handleObj.handler = new_handler + } + } + }; + + function loopy() { + timeout_id = window[str_setTimeout](function () { + elems.each(function () { + var elem = $(this), + width = elem.width(), + height = elem.height(), + data = $.data(this, str_data); + if (width !== data.w || height !== data.h) { + elem.trigger(str_resize, [data.w = width, data.h = height]) + } + }); + loopy() + }, jq_resize[str_delay]) + } + + + var supportTouch = !! ('ontouchstart' in window), + touchStartEvent = supportTouch ? "touchstart" : "mousedown", + touchStopEvent = supportTouch ? "touchend" : "mouseup", + touchMoveEvent = supportTouch ? "touchmove" : "mousemove"; + // also handles swipeleft, swiperight + $.event.special.swipe = { + scrollSupressionThreshold: 10, // More than this horizontal displacement, and we will suppress scrolling. + + durationThreshold: 1000, // More time than this, and it isn't a swipe. + + horizontalDistanceThreshold: 30, // Swipe horizontal displacement must be more than this. + + verticalDistanceThreshold: 75, // Swipe vertical displacement must be less than this. + + setup: function () { + var thisObject = this, + $this = $(thisObject); + + $this.bind(touchStartEvent, function (event) { + var data = event.originalEvent.touches ? event.originalEvent.touches[0] : event, + start = { + time: (new Date()).getTime(), + coords: [data.pageX, data.pageY], + origin: $(event.target) + }, + stop; + + function moveHandler(event) { + + if (!start) { + return; + } + + var data = event.originalEvent.touches ? event.originalEvent.touches[0] : event; + + stop = { + time: (new Date()).getTime(), + coords: [data.pageX, data.pageY] + }; + + // prevent scrolling + if (Math.abs(start.coords[0] - stop.coords[0]) > $.event.special.swipe.scrollSupressionThreshold) { + event.preventDefault(); + } + } + + $this.bind(touchMoveEvent, moveHandler).one(touchStopEvent, function (event) { + $this.unbind(touchMoveEvent, moveHandler); + + if (start && stop) { + if (stop.time - start.time < $.event.special.swipe.durationThreshold && Math.abs(start.coords[0] - stop.coords[0]) > $.event.special.swipe.horizontalDistanceThreshold && Math.abs(start.coords[1] - stop.coords[1]) < $.event.special.swipe.verticalDistanceThreshold) { + + start.origin.trigger("swipe").trigger(start.coords[0] > stop.coords[0] ? "swipeleft" : "swiperight"); + } + } + start = stop = undefined; + }); + }); + } + }; + + + $.each({ + swipeleft: "swipe", + swiperight: "swipe" + }, function (event, sourceEvent) { + + $.event.special[event] = { + setup: function () { + $(this).bind(sourceEvent, $.noop); + } + }; + }); + +})(jQuery, this); From 3ba61219fa047a7db192083ed11f165390912062 Mon Sep 17 00:00:00 2001 From: Ash Whiting Date: Fri, 23 Aug 2013 17:01:48 +0100 Subject: [PATCH 5/7] Minified updated code Minified bugfix --- js/iview.min.js | 57 +------------------------------------------------ 1 file changed, 1 insertion(+), 56 deletions(-) diff --git a/js/iview.min.js b/js/iview.min.js index edeeda1..bdda15c 100644 --- a/js/iview.min.js +++ b/js/iview.min.js @@ -8,59 +8,4 @@ * http://iprodev.com/ * */ -(function(d,v,q){function y(){z=v[s](function(){o.each(function(){var a=d(this),b=a.width(),c=a.height(),f=d.data(this,u);if(b!==f.w||c!==f.h)a.trigger(w,[f.w=b,f.h=c])});y()},p[A])}var B=function(a,b){var c=this;c.options=b;c.sliderContent=a;c.sliderInner=c.sliderContent.html();c.sliderContent.html("
"+c.sliderInner+"
");c.slider=d(".iviewSlider",c.sliderContent);c.slider.css("position","relative");c.defs={slide:0,total:0,image:"",images:[],width:c.sliderContent.width(), -height:c.sliderContent.height(),timer:b.timer.toLowerCase(),lock:!1,paused:b.autoAdvance?!1:!0,time:b.pauseTime,easing:b.easing};c.disableSelection(c.slider[0]);c.slides=c.slider.children();c.slides.each(function(){var a=d(this);c.defs.images.push(a.data("iview:image"));a.data("iview:thumbnail")&&c.defs.images.push(a.data("iview:thumbnail"));a.css("display","none");if("video"==a.data("iview:type")){var f=a.children().eq(0),e=d('');a.append(e);f.appendTo(d("div.iview-video-container",e));e.css({width:c.defs.width,height:c.defs.height,top:"-"+c.defs.height+"px"}).hide();a.addClass("iview-video").css({cursor:"pointer"})}c.defs.total++}).css({width:c.defs.width,height:c.defs.height});c.sliderContent.append('
');var f=d("#iview-preloader",c.sliderContent),e=d("div",f);f.css({top:c.defs.height/2-f.height()/2+"px",left:c.defs.width/2-f.width()/2+"px"}); -c.sliderContent.append('
');c.iviewTimer=d("#iview-timer",c.sliderContent);c.iviewTimer.hide();d(".iview-caption",c.slider).each(function(){var a=d(this);a.html('
'+a.html()+"
")});b.startSlide=b.randomStart?Math.floor(Math.random()*c.defs.total):b.startSlide;b.startSlide=0=c.defs.total?c.defs.total-1:b.startSlide;c.defs.slide=b.startSlide;c.defs.image=c.slides.eq(c.defs.slide);c.defs.time=c.defs.image.data("iview:pausetime")? -c.defs.image.data("iview:pausetime"):b.pauseTime;c.defs.easing=c.defs.image.data("iview:easing")?c.defs.image.data("iview:easing"):b.easing;c.pieDegree=0;var g=b.timerPadding,k=b.timerDiameter,h=b.timerStroke;if(1'+a.options.previousLabel+''+a.options.nextLabel+""),d(".iview-directionNav",a.sliderContent).css({opacity:a.options.directionNavHoverOpacity}), -a.sliderContent.hover(function(){d(".iview-directionNav",a.sliderContent).stop().animate({opacity:1},300)},function(){d(".iview-directionNav",a.sliderContent).stop().animate({opacity:a.options.directionNavHoverOpacity},300)}),d("a.iview-prevNav",a.sliderContent).live("click",function(){if(a.defs.lock)return false;a.cleanTimer();a.defs.slide=a.defs.slide-2;a.goTo("prev")}),d("a.iview-nextNav",a.sliderContent).live("click",function(){if(a.defs.lock)return false;a.cleanTimer();a.goTo("next")}));if(a.options.controlNav){var b= -'
',c="";!a.options.directionNav&&a.options.controlNavNextPrev&&(b+=''+a.options.previousLabel+"");for(var b=b+'
    ',f=0;f";a.options.controlNavThumbs?(e=e.data("iview:thumbnail")?e.data("iview:thumbnail"):e.data("iview:image"),b+=''):(e=e.data("iview:thumbnail")?e.data("iview:thumbnail"): -e.data("iview:image"),b+=''+(f+1)+"",a.options.controlNavTooltip&&(c+='
    '));b+=""}b+="
";!a.options.directionNav&&a.options.controlNavNextPrev&&(b+=''+a.options.nextLabel+"");b+="
";!a.options.controlNavThumbs&&a.options.controlNavTooltip&&(b+='
'+c+"
"); -a.sliderContent.append(b);d(".iview-controlNav a.iview-control:eq("+a.defs.slide+")",a.sliderContent).addClass("active");d("a.iview-controlPrevNav",a.sliderContent).live("click",function(){if(a.defs.lock)return false;a.cleanTimer();a.defs.slide=a.defs.slide-2;a.goTo("prev")});d("a.iview-controlNextNav",a.sliderContent).live("click",function(){if(a.defs.lock)return false;a.cleanTimer();a.goTo("next")});d(".iview-controlNav a.iview-control",a.sliderContent).live("click",function(){if(a.defs.lock||d(this).hasClass("active"))return false; -a.cleanTimer();a.slider.css("background",'url("'+a.defs.image.data("iview:image")+'") no-repeat');a.defs.slide=d(this).attr("rel")-1;a.goTo("control")});d(".iview-controlNav",a.sliderContent).css({opacity:a.options.controlNavHoverOpacity});a.sliderContent.hover(function(){d(".iview-controlNav",a.sliderContent).stop().animate({opacity:1},300);a.sliderContent.addClass("iview-hover")},function(){d(".iview-controlNav",a.sliderContent).stop().animate({opacity:a.options.controlNavHoverOpacity},300);a.sliderContent.removeClass("iview-hover")}); -var g=null;d(".iview-controlNav a.iview-control",a.sliderContent).hover(function(){var b=d(this),c=b.attr("rel"),f=d("#iview-tooltip",a.sliderContent),e=d("div.holder",f),l=b.offset().left-a.sliderContent.offset().left-f.outerWidth()/2+a.options.tooltipX,b=b.offset().top-a.sliderContent.offset().top-f.outerHeight()+a.options.tooltipY,n=d("div[rel="+c+"]");scrollLeft=c*n.width();f.stop().animate({left:l,top:b,opacity:1},300);f.not(":visible")&&f.fadeIn(300);e.stop().animate({scrollLeft:scrollLeft}, -300);clearTimeout(g)},function(){var b=d("#iview-tooltip",a.sliderContent);g=setTimeout(function(){b.animate({opacity:0},300,function(){b.hide()})},200)})}a.sliderContent.bind("mouseover.iView mousemove.iView",function(){a.options.pauseOnHover&&!a.defs.paused&&a.cleanTimer();a.sliderContent.addClass("iview-hover")}).bind("mouseout.iView",function(){a.options.pauseOnHover&&(!a.defs.paused&&a.timer==null&&a.pieDegree<=359&&a.options.autoAdvance)&&a.setTimer();a.sliderContent.removeClass("iview-hover")})}, -setCaption:function(){var a=this,b=a.slides.eq(a.defs.slide),c=0;d(".iview-caption",b).each(function(){var b=d(this),e=b.data("transition")?d.trim(b.data("transition").toLowerCase()):"fade",g=b.data("speed")?b.data("speed"):a.options.captionSpeed,k=b.data("easing")?b.data("easing"):a.options.captionEasing,h="undefined"!=b.data("x")?b.data("x"):"center",i="undefined"!=b.data("y")?b.data("y"):"center",j=b.data("width")?b.data("width"):b.width(),l=b.data("height")?b.data("height"):b.height(),n=b.outerWidth(), -o=b.outerHeight();"center"==h&&(h=a.defs.width/2-n/2);"center"==i&&(i=a.defs.height/2-o/2);var m=d(".caption-contain",b);b.css({opacity:0});m.css({opacity:0,position:"relative",width:j,height:l});switch(e){case "wipedown":b.css({top:i-l,left:h});m.css({top:l+3*l,left:0});break;case "wipeup":b.css({top:i+l,left:h});m.css({top:l-3*l,left:0});break;case "wiperight":b.css({top:i,left:h-j});m.css({top:0,left:j+2*j});break;case "wipeleft":b.css({top:i,left:h+j});m.css({top:0,left:j-2*j});break;case "fade":b.css({top:i, -left:h});m.css({top:0,left:0});break;case "expanddown":b.css({top:i,left:h,height:0});m.css({top:l+3*l,left:0});break;case "expandup":b.css({top:i+l,left:h,height:0});m.css({top:l-3*l,left:0});break;case "expandright":b.css({top:i,left:h,width:0});m.css({top:0,left:j+2*j});break;case "expandleft":b.css({top:i,left:h+j,width:0}),m.css({top:0,left:j-2*j})}setTimeout(function(){b.animate({opacity:a.options.captionOpacity,top:i,left:h,width:j,height:l},g,k,function(){})},c);setTimeout(function(){m.animate({opacity:a.options.captionOpacity, -top:0,left:0},g,k)},c+100);c+=250})},processTimer:function(){if("360bar"==this.defs.timer){var a=0==this.pieDegree?0:this.pieDegree+0.9;this.timerPath.attr({arc:[a,this.R]})}else"pie"==this.defs.timer?(a=0==this.pieDegree?0:this.pieDegree+0.9,this.pieTimer.attr({segment:[a,this.R]})):this.barTimer.css({width:100*(this.pieDegree/360)+"%"});this.pieDegree+=3},transitionEnd:function(a){a.options.onAfterChange.call(this);a.defs.lock=!1;a.slides.css("display","none");a.slides.eq(a.defs.slide).show();a.slider.css("background", -'url("'+a.defs.image.data("iview:image")+'") no-repeat');d(".iview-strip, .iview-block",a.slider).remove();a.defs.time=a.defs.image.data("iview:pausetime")?a.defs.image.data("iview:pausetime"):a.options.pauseTime;a.iviewTimer.animate({opacity:a.options.timerOpacity});a.pieDegree=0;a.processTimer();a.setCaption(a.options);null==a.timer&&!a.defs.paused&&(a.timer=setInterval(function(){a.timerCall(a)},a.defs.time/120))},addStrips:function(a,b){for(var b=b?b:this.options,c=0;c').css({width:f,height:e,top:k,left:h,background:'url("'+this.defs.image.data("iview:image")+'") no-repeat '+g,opacity:0});this.slider.append(g)}},addBlocks:function(){for(var a=Math.round(this.slider.width()/ -this.options.blockCols),b=Math.round(this.slider.height()/this.options.blockRows),c=0;c').css({width:a+"px",height:b+"px",top:c*b+"px",left:f*a+"px",background:'url("'+this.defs.image.data("iview:image")+'") no-repeat '+e,opacity:0});this.slider.append(e)}},runTransition:function(a){var b=this;switch(a){case "strip-up-right":case "strip-up-left":b.addStrips(); -var c=0,f=0,e=d(".iview-strip",b.slider);"strip-up-left"==a&&(e=d(".iview-strip",b.slider).reverse());e.each(function(){var a=d(this);a.css({top:"",bottom:"0px"});setTimeout(function(){a.animate({height:"100%",opacity:"1.0"},b.options.animationSpeed,b.defs.easing,function(){f==b.options.strips-1&&b.transitionEnd(b);f++})},100+c);c+=50});break;case "strip-down":case "strip-down-right":case "strip-down-left":b.addStrips();var f=c=0,e=d(".iview-strip",b.slider);"strip-down-left"==a&&(e=d(".iview-strip", -b.slider).reverse());e.each(function(){var a=d(this);a.css({bottom:"",top:"0px"});setTimeout(function(){a.animate({height:"100%",opacity:"1.0"},b.options.animationSpeed,b.defs.easing,function(){f==b.options.strips-1&&b.transitionEnd(b);f++})},100+c);c+=50});break;case "strip-left-right":case "strip-left-right-up":case "strip-left-right-down":b.addStrips(!0);var g=f=c=0,e=d(".iview-strip",b.slider);"strip-left-right-down"==a&&(e=d(".iview-strip",b.slider).reverse());e.each(function(){var a=d(this); -0==f?(a.css({right:"",left:"0px"}),f++):(a.css({left:"",right:"0px"}),f=0);setTimeout(function(){a.animate({width:"100%",opacity:"1.0"},b.options.animationSpeed,b.defs.easing,function(){g==b.options.strips-1&&b.transitionEnd(b);g++})},100+c);c+=50});break;case "strip-up-down":case "strip-up-down-right":case "strip-up-down-left":b.addStrips();g=f=c=0;e=d(".iview-strip",b.slider);"strip-up-down-left"==a&&(e=d(".iview-strip",b.slider).reverse());e.each(function(){var a=d(this);0==f?(a.css({bottom:"", -top:"0px"}),f++):(a.css({top:"",bottom:"0px"}),f=0);setTimeout(function(){a.animate({height:"100%",opacity:"1.0"},b.options.animationSpeed,b.defs.easing,function(){g==b.options.strips-1&&b.transitionEnd(b);g++})},100+c);c+=50});break;case "left-curtain":case "right-curtain":case "top-curtain":case "bottom-curtain":"left-curtain"==a||"right-curtain"==a?b.addStrips():b.addStrips(!0);f=c=0;e=d(".iview-strip",b.slider);if("right-curtain"==a||"bottom-curtain"==a)e=d(".iview-strip",b.slider).reverse(); -e.each(function(){var e=d(this),g=e.width(),h=e.height();"left-curtain"==a||"right-curtain"==a?e.css({top:"0px",height:"100%",width:"0px"}):e.css({left:"0px",height:"0px",width:"100%"});setTimeout(function(){"left-curtain"==a||"right-curtain"==a?e.animate({width:g,opacity:"1.0"},b.options.animationSpeed,b.defs.easing,function(){f==b.options.strips-1&&b.transitionEnd(b);f++}):e.animate({height:h,opacity:"1.0"},b.options.animationSpeed,b.defs.easing,function(){f==b.options.strips-1&&b.transitionEnd(b); -f++})},100+c);c+=50});break;case "strip-up-right":case "strip-up-left":b.addStrips();f=c=0;e=d(".iview-strip",b.slider);"strip-up-left"==a&&(e=d(".iview-strip",b.slider).reverse());e.each(function(){var a=d(this);a.css({bottom:"0px"});setTimeout(function(){a.animate({height:"100%",opacity:"1.0"},b.options.animationSpeed,b.defs.easing,function(){f==b.options.strips-1&&b.transitionEnd(b);f++})},100+c);c+=50});break;case "strip-left-fade":case "strip-right-fade":case "strip-top-fade":case "strip-bottom-fade":"strip-left-fade"== -a||"strip-right-fade"==a?b.addStrips():b.addStrips(!0);f=c=0;e=d(".iview-strip",b.slider);if("strip-right-fade"==a||"strip-bottom-fade"==a)e=d(".iview-strip",b.slider).reverse();e.each(function(){var e=d(this),g=e.width(),h=e.height();"strip-left-fade"==a||"strip-right-fade"==a?e.css({top:"0px",height:"100%",width:g}):e.css({left:"0px",height:h,width:"100%"});setTimeout(function(){e.animate({opacity:"1.0"},1.7*b.options.animationSpeed,b.defs.easing,function(){f==b.options.strips-1&&b.transitionEnd(b); -f++})},100+c);c+=35});break;case "slide-in-up":case "slide-in-down":opts={strips:1};b.addStrips(!1,opts);var e=d(".iview-strip:first",b.slider),k=0,k="slide-in-up"==a?"-"+b.defs.height+"px":b.defs.height+"px";e.css({top:k,height:"100%",width:b.defs.width});e.animate({top:"0px",opacity:1},2*b.options.animationSpeed,b.defs.easing,function(){b.transitionEnd(b)});break;case "zigzag-top":case "zigzag-bottom":case "zigzag-grow-top":case "zigzag-grow-bottom":case "zigzag-drop-top":case "zigzag-drop-bottom":b.addBlocks(); -for(var h=b.options.blockCols*b.options.blockRows,c=0,i=[],e=d(".iview-block",b.slider),j=0;j=k;n--)i.push(d(e[n]));else for(n=k;nthis.defs.slide&&(this.defs.slide=this.defs.total-1);this.defs.image=this.slides.eq(this.defs.slide);this.options.controlNav&&(d(".iview-controlNav a.iview-control",this.sliderContent).removeClass("active"),d(".iview-controlNav a.iview-control:eq("+this.defs.slide+")",this.sliderContent).addClass("active"));a=this.options.fx;"random"==this.options.fx.toLowerCase()&&(a="left-curtain right-curtain top-curtain bottom-curtain strip-down-right strip-down-left strip-up-right strip-up-left strip-up-down strip-up-down-left strip-left-right strip-left-right-down slide-in-right slide-in-left slide-in-up slide-in-down fade block-random block-fade block-fade-reverse block-expand block-expand-reverse block-expand-random zigzag-top zigzag-bottom zigzag-grow-top zigzag-grow-bottom zigzag-drop-top zigzag-drop-bottom strip-left-fade strip-right-fade strip-top-fade strip-bottom-fade block-drop-random".split(" "), -a=a[Math.floor(Math.random()*(a.length+1))],a==q&&(a="fade"),a=d.trim(a.toLowerCase()));-1!=this.options.fx.indexOf(",")&&(a=this.options.fx.split(","),a=a[Math.floor(Math.random()*a.length)],a==q&&(a="fade"),a=d.trim(a.toLowerCase()));this.defs.image.data("iview:transition")&&(a=this.defs.image.data("iview:transition").split(","),a=a[Math.floor(Math.random()*a.length)],a=d.trim(a.toLowerCase()));this.defs.easing=this.defs.image.data("iview:easing")?this.defs.image.data("iview:easing"):this.options.easing; -this.defs.lock=!0;this.runTransition(a)},playSlider:function(){null==this.timer&&this.defs.paused&&(this.iviewTimer.removeClass("paused").attr("title",this.options.pauseLabel),this.setTimer(),this.defs.paused=!1,this.options.onPlay.call(this))},stopSlider:function(){this.iviewTimer.addClass("paused").attr("title",this.options.playLabel);this.cleanTimer();this.defs.paused=!0;this.options.onPause.call(this)},setTimerPosition:function(){for(var a=this.options.timerPosition.toLowerCase().split("-"),b= -0;bd.event.special.swipe.scrollSupressionThreshold&&a.preventDefault()}}var f=b.originalEvent.touches? -b.originalEvent.touches[0]:b,e={time:(new Date).getTime(),coords:[f.pageX,f.pageY],origin:d(b.target)},g;a.bind(C,c).one(F,function(){a.unbind(C,c);e&&g&&g.time-e.timed.event.special.swipe.horizontalDistanceThreshold&&Math.abs(e.coords[1]-g.coords[1])g.coords[0]?"swipeleft":"swiperight");e=g=q})})}};d.each({swipeleft:"swipe", -swiperight:"swipe"},function(a,b){d.event.special[a]={setup:function(){d(this).bind(b,d.noop)}}})})(jQuery,this); \ No newline at end of file +(function($,window,undefined){var iView=function(el,options){var iv=this;iv.options=options;iv.sliderContent=el,iv.sliderInner=iv.sliderContent.html();iv.sliderContent.html("
"+iv.sliderInner+"
");iv.slider=$('.iviewSlider',iv.sliderContent);iv.slider.css('position','relative');iv.defs={slide:0,total:0,image:'',images:[],width:iv.sliderContent.width(),height:iv.sliderContent.height(),timer:options.timer.toLowerCase(),lock:false,paused:(options.autoAdvance)?false:true,time:options.pauseTime,easing:options.easing};iv.disableSelection(iv.slider[0]);iv.slides=iv.slider.children();iv.slides.each(function(i){var slide=$(this);iv.defs.images.push(slide.data("iview:image"));if(slide.data("iview:thumbnail"))iv.defs.images.push(slide.data("iview:thumbnail"));slide.css('display','none');if(slide.data("iview:type")=="video"){var element=slide.children().eq(0),video=$('');slide.append(video);element.appendTo($('div.iview-video-container',video));video.css({width:iv.defs.width,height:iv.defs.height,top:'-'+iv.defs.height+'px'}).hide();slide.addClass('iview-video').css({'cursor':'pointer'})}iv.defs.total++}).css({width:iv.defs.width,height:iv.defs.height});iv.sliderContent.append('
');var iviewPreloader=$('#iview-preloader',iv.sliderContent);var preloaderBar=$('div',iviewPreloader);iviewPreloader.css({top:((iv.defs.height/2)-(iviewPreloader.height()/2))+'px',left:((iv.defs.width/2)-(iviewPreloader.width()/2))+'px'});iv.sliderContent.append('
');iv.iviewTimer=$('#iview-timer',iv.sliderContent);iv.iviewTimer.hide();$('.iview-caption',iv.slider).each(function(i){var caption=$(this);caption.html('
'+caption.html()+'
')});options.startSlide=(options.randomStart)?Math.floor(Math.random()*iv.defs.total):options.startSlide;options.startSlide=(options.startSlide>0&&options.startSlide>=iv.defs.total)?iv.defs.total-1:options.startSlide;iv.defs.slide=options.startSlide;iv.defs.image=iv.slides.eq(iv.defs.slide);iv.defs.time=(iv.defs.image.data('iview:pausetime'))?iv.defs.image.data('iview:pausetime'):options.pauseTime;iv.defs.easing=(iv.defs.image.data('iview:easing'))?iv.defs.image.data('iview:easing'):options.easing;iv.pieDegree=0;var padding=options.timerPadding,diameter=options.timerDiameter,stroke=options.timerStroke;if(iv.defs.total>1&&iv.defs.timer!="bar"){stroke=(iv.defs.timer=="360bar")?options.timerStroke:0;var width=(diameter+(padding*2)+(stroke*2)),height=width,r=Raphael(iv.iviewTimer[0],width,height);iv.R=(diameter/2);var param={stroke:options.timerBg,"stroke-width":(stroke+(padding*2))},param2={stroke:options.timerColor,"stroke-width":stroke,"stroke-linecap":"round"},param3={fill:options.timerColor,stroke:'none',"stroke-width":0},bgParam={fill:options.timerBg,stroke:'none',"stroke-width":0};r.customAttributes.arc=function(value,R){var total=360,alpha=360/total*value,a=(90-alpha)*Math.PI/180,cx=((diameter/2)+padding+stroke),cy=((diameter/2)+padding+stroke),x=cx+R*Math.cos(a),y=cy-R*Math.sin(a),path;if(total==value){path=[["M",cx,cy-R],["A",R,R,0,1,1,299.99,cy-R]]}else{path=[["M",cx,cy-R],["A",R,R,0,+(alpha>180),1,x,y]]}return{path:path}};r.customAttributes.segment=function(angle,R){var a1=-90;R=R-1;angle=(a1+angle);var flag=(angle-a1)>180,x=((diameter/2)+padding),y=((diameter/2)+padding);a1=(a1%360)*Math.PI/180;angle=(angle%360)*Math.PI/180;return{path:[["M",x,y],["l",R*Math.cos(a1),R*Math.sin(a1)],["A",R,R,0,+flag,1,x+R*Math.cos(angle),y+R*Math.sin(angle)],["z"]]}};if(iv.defs.total>1&&iv.defs.timer=="pie"){r.circle(iv.R+padding,iv.R+padding,iv.R+padding-1).attr(bgParam)}iv.timerBgPath=r.path().attr(param),iv.timerPath=r.path().attr(param2),iv.pieTimer=r.path().attr(param3)}iv.barTimer=$('div',iv.iviewTimer);if(iv.defs.total>1&&iv.defs.timer=="360bar"){iv.timerBgPath.attr({arc:[359.9,iv.R]})}if(iv.defs.timer=="bar"){iv.iviewTimer.css({opacity:options.timerOpacity,width:diameter,height:stroke,border:options.timerBarStroke+'px '+options.timerBarStrokeColor+' '+options.timerBarStrokeStyle,padding:padding,background:options.timerBg});iv.barTimer.css({width:0,height:stroke,background:options.timerColor,'float':'left'})}else{iv.iviewTimer.css({opacity:options.timerOpacity,width:width,height:height})}iv.setTimerPosition();new ImagePreload(iv.defs.images,function(i){var percent=(i*10);preloaderBar.stop().animate({width:percent+'%'})},function(){preloaderBar.stop().animate({width:'100%'},function(){iviewPreloader.remove();iv.startSlider();options.onAfterLoad.call(this)})});iv.sliderContent.bind('swipeleft',function(){if(iv.defs.lock)return false;iv.cleanTimer();iv.goTo('next')}).bind('swiperight',function(){if(iv.defs.lock)return false;iv.cleanTimer();iv.defs.slide-=2;iv.goTo('prev')});if(options.keyboardNav){$(document).bind('keyup.iView',function(event){if(event.keyCode=='37'){if(iv.defs.lock)return false;iv.cleanTimer();iv.defs.slide-=2;iv.goTo('prev')}if(event.keyCode=='39'){if(iv.defs.lock)return false;iv.cleanTimer();iv.goTo('next')}})}iv.iviewTimer.on('click',function(){if(iv.iviewTimer.hasClass('paused')){iv.playSlider()}else{iv.stopSlider()}});iv.sliderContent.bind('iView:pause',function(){iv.stopSlider()});iv.sliderContent.bind('iView:play',function(){iv.playSlider()});iv.sliderContent.bind('iView:previous',function(){if(iv.defs.lock)return false;iv.cleanTimer();iv.defs.slide-=2;iv.goTo('prev')});iv.sliderContent.bind('iView:next',function(){if(iv.defs.lock)return false;iv.cleanTimer();iv.goTo('next')});iv.sliderContent.bind('iView:goSlide',function(event,slide){if(iv.defs.lock||iv.defs.slide==slide)return false;if($(this).hasClass('active'))return false;iv.cleanTimer();iv.slider.css('background','url("'+iv.defs.image.data('iview:image')+'") no-repeat');iv.defs.slide=slide-1;iv.goTo('control')});iv.sliderContent.bind('resize',function(){t=$(this),tW=t.width(),tH=t.height(),width=iv.slider.width(),height=iv.slider.height();if(iv.defs.width!=tW){var ratio=(tW/width),newHeight=Math.round(iv.defs.height*ratio);iv.slider.css({'-webkit-transform-origin':'0 0','-moz-transform-origin':'0 0','-o-transform-origin':'0 0','-ms-transform-origin':'0 0','transform-origin':'0 0','-webkit-transform':'scale('+ratio+')','-moz-transform':'scale('+ratio+')','-o-transform':'scale('+ratio+')','-ms-transform':'scale('+ratio+')','transform':'scale('+ratio+')'});t.css({height:newHeight});iv.defs.width=tW;iv.setTimerPosition()}});$('.iview-video',iv.slider).click(function(e){var t=$(this),video=$('.iview-video-show',t);if(!$(e.target).hasClass('iview-video-close')&&!$(e.target).hasClass('iview-caption')&&!$(e.target).parents().hasClass('iview-caption')){video.show().animate({top:0},1000,'easeOutBounce');iv.sliderContent.trigger('iView:pause')}});$('.iview-video-close',iv.slider).click(function(){var video=$(this).parents('.iview-video-show'),iframe=$('iframe',video),src=iframe.attr('src');iframe.removeAttr('src').attr('src',src);video.animate({top:'-'+iv.defs.height+'px'},1000,'easeOutBounce',function(){video.hide();iv.sliderContent.trigger('iView:play')})})};iView.prototype={timer:null,startSlider:function(){var iv=this;var img=new Image();img.src=iv.slides.eq(0).data('iview:image');imgWidth=img.width;if(imgWidth!=iv.defs.width){iv.defs.width=imgWidth;iv.sliderContent.trigger('resize')}iv.iviewTimer.show();iv.slides.eq(iv.defs.slide).css('display','block');iv.slider.css('background','url("'+iv.defs.image.data('iview:image')+'") no-repeat');iv.setCaption(iv.options);iv.iviewTimer.addClass('paused').attr('title',iv.options.playLabel);if(iv.options.autoAdvance&&iv.defs.total>1){iv.iviewTimer.removeClass('paused').attr('title',iv.options.pauseLabel);iv.setTimer()}if(iv.options.directionNav){iv.sliderContent.append('');$('.iview-directionNav',iv.sliderContent).css({opacity:iv.options.directionNavHoverOpacity});iv.sliderContent.hover(function(){$('.iview-directionNav',iv.sliderContent).stop().animate({opacity:1},300)},function(){$('.iview-directionNav',iv.sliderContent).stop().animate({opacity:iv.options.directionNavHoverOpacity},300)});$('a.iview-prevNav',iv.sliderContent).on('click',function(){if(iv.defs.lock)return false;iv.cleanTimer();iv.defs.slide-=2;iv.goTo('prev')});$('a.iview-nextNav',iv.sliderContent).on('click',function(){if(iv.defs.lock)return false;iv.cleanTimer();iv.goTo('next')})}if(iv.options.controlNav){var iviewControl='
',iviewTooltip='';if(!iv.options.directionNav&&iv.options.controlNavNextPrev)iviewControl+=''+iv.options.previousLabel+'';iviewControl+='
    ';for(var i=0;i';if(iv.options.controlNavThumbs){var thumb=(slide.data('iview:thumbnail'))?slide.data('iview:thumbnail'):slide.data('iview:image');iviewControl+=''}else{var thumb=(slide.data('iview:thumbnail'))?slide.data('iview:thumbnail'):slide.data('iview:image');iviewControl+=''+(i+1)+'';if(iv.options.controlNavTooltip)iviewTooltip+='
    '}iviewControl+=''}iviewControl+='
';if(!iv.options.directionNav&&iv.options.controlNavNextPrev)iviewControl+=''+iv.options.nextLabel+'';iviewControl+='
';if(!iv.options.controlNavThumbs&&iv.options.controlNavTooltip)iviewControl+='
'+iviewTooltip+'
';iv.sliderContent.append(iviewControl);$('.iview-controlNav a.iview-control:eq('+iv.defs.slide+')',iv.sliderContent).addClass('active');$('a.iview-controlPrevNav',iv.sliderContent).on('click',function(){if(iv.defs.lock)return false;iv.cleanTimer();iv.defs.slide-=2;iv.goTo('prev')});$('a.iview-controlNextNav',iv.sliderContent).on('click',function(){if(iv.defs.lock)return false;iv.cleanTimer();iv.goTo('next')});$('.iview-controlNav a.iview-control',iv.sliderContent).on('click',function(){if(iv.defs.lock)return false;if($(this).hasClass('active'))return false;iv.cleanTimer();iv.slider.css('background','url("'+iv.defs.image.data('iview:image')+'") no-repeat');iv.defs.slide=$(this).attr('rel')-1;iv.goTo('control')});$('.iview-controlNav',iv.sliderContent).css({opacity:iv.options.controlNavHoverOpacity});iv.sliderContent.hover(function(){$('.iview-controlNav',iv.sliderContent).stop().animate({opacity:1},300);iv.sliderContent.addClass('iview-hover')},function(){$('.iview-controlNav',iv.sliderContent).stop().animate({opacity:iv.options.controlNavHoverOpacity},300);iv.sliderContent.removeClass('iview-hover')});var tooltipTimer=null;$('.iview-controlNav a.iview-control',iv.sliderContent).hover(function(e){var t=$(this),i=t.attr('rel'),tooltip=$('#iview-tooltip',iv.sliderContent),holder=$('div.holder',tooltip),x=t.offset().left-iv.sliderContent.offset().left-(tooltip.outerWidth()/2)+iv.options.tooltipX,y=t.offset().top-iv.sliderContent.offset().top-tooltip.outerHeight()+iv.options.tooltipY,imD=$('div[rel='+i+']')scrollLeft=(i*imD.width());tooltip.stop().animate({left:x,top:y,opacity:1},300);if(tooltip.not(':visible'))tooltip.fadeIn(300);holder.stop().animate({scrollLeft:scrollLeft},300);clearTimeout(tooltipTimer)},function(e){var tooltip=$('#iview-tooltip',iv.sliderContent);tooltipTimer=setTimeout(function(){tooltip.animate({opacity:0},300,function(){tooltip.hide()})},200)})}iv.sliderContent.bind('mouseover.iView mousemove.iView',function(){if(iv.options.pauseOnHover&&!iv.defs.paused)iv.cleanTimer();iv.sliderContent.addClass('iview-hover')}).bind('mouseout.iView',function(){if(iv.options.pauseOnHover&&!iv.defs.paused&&iv.timer==null&&iv.pieDegree<=359&&iv.options.autoAdvance)iv.setTimer();iv.sliderContent.removeClass('iview-hover')})},setCaption:function(){var iv=this,slide=iv.slides.eq(iv.defs.slide),captions=$('.iview-caption',slide),timeEx=0;captions.each(function(i){var caption=$(this),fx=(caption.data('transition'))?$.trim(caption.data('transition').toLowerCase()):"fade",speed=(caption.data('speed'))?caption.data('speed'):iv.options.captionSpeed,easing=(caption.data('easing'))?caption.data('easing'):iv.options.captionEasing,x=(caption.data('x')!="undefined")?caption.data('x'):"center",y=(caption.data('y')!="undefined")?caption.data('y'):"center",w=(caption.data('width'))?caption.data('width'):caption.width(),h=(caption.data('height'))?caption.data('height'):caption.height(),oW=caption.outerWidth(),oH=caption.outerHeight();if(x=="center")x=((iv.defs.width/2)-(oW/2));if(y=="center")y=((iv.defs.height/2)-(oH/2));var captionContain=$('.caption-contain',caption);caption.css({opacity:0});captionContain.css({opacity:0,position:'relative',width:w,height:h});switch(fx){case"wipedown":caption.css({top:(y-h),left:x});captionContain.css({top:(h+(h*3)),left:0});break;case"wipeup":caption.css({top:(y+h),left:x});captionContain.css({top:(h-(h*3)),left:0});break;case"wiperight":caption.css({top:y,left:(x-w)});captionContain.css({top:0,left:(w+(w*2))});break;case"wipeleft":caption.css({top:y,left:(x+w)});captionContain.css({top:0,left:(w-(w*2))});break;case"fade":caption.css({top:y,left:x});captionContain.css({top:0,left:0});break;case"expanddown":caption.css({top:y,left:x,height:0});captionContain.css({top:(h+(h*3)),left:0});break;case"expandup":caption.css({top:(y+h),left:x,height:0});captionContain.css({top:(h-(h*3)),left:0});break;case"expandright":caption.css({top:y,left:x,width:0});captionContain.css({top:0,left:(w+(w*2))});break;case"expandleft":caption.css({top:y,left:(x+w),width:0});captionContain.css({top:0,left:(w-(w*2))});break}setTimeout(function(){caption.animate({opacity:iv.options.captionOpacity,top:y,left:x,width:w,height:h},speed,easing,function(){})},timeEx);setTimeout(function(){captionContain.animate({opacity:iv.options.captionOpacity,top:0,left:0},speed,easing)},(timeEx+100));timeEx+=250})},processTimer:function(){var iv=this;if(iv.defs.timer=="360bar"){var degree=(iv.pieDegree==0)?0:iv.pieDegree+.9;iv.timerPath.attr({arc:[degree,iv.R]})}else if(iv.defs.timer=="pie"){var degree=(iv.pieDegree==0)?0:iv.pieDegree+.9;iv.pieTimer.attr({segment:[degree,iv.R]})}else{iv.barTimer.css({width:((iv.pieDegree/360)*100)+'%'})}iv.pieDegree+=3},transitionEnd:function(iv){iv.options.onAfterChange.call(this);iv.defs.lock=false;iv.slides.css('display','none');iv.slides.eq(iv.defs.slide).show();iv.slider.css('background','url("'+iv.defs.image.data('iview:image')+'") no-repeat');$('.iview-strip, .iview-block',iv.slider).remove();iv.defs.time=(iv.defs.image.data('iview:pausetime'))?iv.defs.image.data('iview:pausetime'):iv.options.pauseTime;iv.iviewTimer.animate({opacity:iv.options.timerOpacity});iv.pieDegree=0;iv.processTimer();iv.setCaption(iv.options);if(iv.timer==null&&!iv.defs.paused)iv.timer=setInterval(function(){iv.timerCall(iv)},(iv.defs.time/120))},addStrips:function(vertical,opts){var iv=this;opts=(opts)?opts:iv.options;for(var i=0;i').css({width:width,height:height,top:top,left:left,background:'url("'+iv.defs.image.data('iview:image')+'") no-repeat '+bgPosition,opacity:0});iv.slider.append(strip)}},addBlocks:function(){var iv=this,blockWidth=Math.round(iv.slider.width()/iv.options.blockCols),blockHeight=Math.round(iv.slider.height()/iv.options.blockRows);for(var rows=0;rows').css({width:blockWidth+'px',height:blockHeight+'px',top:(rows*blockHeight)+'px',left:(columns*blockWidth)+'px',background:'url("'+iv.defs.image.data('iview:image')+'") no-repeat '+bgPosition,opacity:0});iv.slider.append(block)}}},runTransition:function(fx){var iv=this;switch(fx){case'strip-up-right':case'strip-up-left':iv.addStrips();var timeDelay=0;i=0,strips=$('.iview-strip',iv.slider);if(fx=='strip-up-left')strips=$('.iview-strip',iv.slider).reverse();strips.each(function(){var strip=$(this);strip.css({top:'',bottom:'0px'});setTimeout(function(){strip.animate({height:'100%',opacity:'1.0'},iv.options.animationSpeed,iv.defs.easing,function(){if(i==iv.options.strips-1)iv.transitionEnd(iv);i++})},(100+timeDelay));timeDelay+=50});break;case'strip-down':case'strip-down-right':case'strip-down-left':iv.addStrips();var timeDelay=0,i=0,strips=$('.iview-strip',iv.slider);if(fx=='strip-down-left')strips=$('.iview-strip',iv.slider).reverse();strips.each(function(){var strip=$(this);strip.css({bottom:'',top:'0px'});setTimeout(function(){strip.animate({height:'100%',opacity:'1.0'},iv.options.animationSpeed,iv.defs.easing,function(){if(i==iv.options.strips-1)iv.transitionEnd(iv);i++})},(100+timeDelay));timeDelay+=50});break;case'strip-left-right':case'strip-left-right-up':case'strip-left-right-down':iv.addStrips(true);var timeDelay=0,i=0,v=0,strips=$('.iview-strip',iv.slider);if(fx=='strip-left-right-down')strips=$('.iview-strip',iv.slider).reverse();strips.each(function(){var strip=$(this);if(i==0){strip.css({right:'',left:'0px'});i++}else{strip.css({left:'',right:'0px'});i=0}setTimeout(function(){strip.animate({width:'100%',opacity:'1.0'},iv.options.animationSpeed,iv.defs.easing,function(){if(v==iv.options.strips-1)iv.transitionEnd(iv);v++})},(100+timeDelay));timeDelay+=50});break;case'strip-up-down':case'strip-up-down-right':case'strip-up-down-left':iv.addStrips();var timeDelay=0,i=0,v=0,strips=$('.iview-strip',iv.slider);if(fx=='strip-up-down-left')strips=$('.iview-strip',iv.slider).reverse();strips.each(function(){var strip=$(this);if(i==0){strip.css({bottom:'',top:'0px'});i++}else{strip.css({top:'',bottom:'0px'});i=0}setTimeout(function(){strip.animate({height:'100%',opacity:'1.0'},iv.options.animationSpeed,iv.defs.easing,function(){if(v==iv.options.strips-1)iv.transitionEnd(iv);v++})},(100+timeDelay));timeDelay+=50});break;case'left-curtain':case'right-curtain':case'top-curtain':case'bottom-curtain':if(fx=='left-curtain'||fx=='right-curtain')iv.addStrips();else iv.addStrips(true);var timeDelay=0,i=0,strips=$('.iview-strip',iv.slider);if(fx=='right-curtain'||fx=='bottom-curtain')strips=$('.iview-strip',iv.slider).reverse();strips.each(function(){var strip=$(this);var width=strip.width();var height=strip.height();if(fx=='left-curtain'||fx=='right-curtain')strip.css({top:'0px',height:'100%',width:'0px'});else strip.css({left:'0px',height:'0px',width:'100%'});setTimeout(function(){if(fx=='left-curtain'||fx=='right-curtain')strip.animate({width:width,opacity:'1.0'},iv.options.animationSpeed,iv.defs.easing,function(){if(i==iv.options.strips-1)iv.transitionEnd(iv);i++});else strip.animate({height:height,opacity:'1.0'},iv.options.animationSpeed,iv.defs.easing,function(){if(i==iv.options.strips-1)iv.transitionEnd(iv);i++})},(100+timeDelay));timeDelay+=50});break;case'strip-up-right':case'strip-up-left':iv.addStrips();var timeDelay=0,i=0,strips=$('.iview-strip',iv.slider);if(fx=='strip-up-left')strips=$('.iview-strip',iv.slider).reverse();strips.each(function(){var strip=$(this);strip.css({'bottom':'0px'});setTimeout(function(){strip.animate({height:'100%',opacity:'1.0'},iv.options.animationSpeed,iv.defs.easing,function(){if(i==iv.options.strips-1)iv.transitionEnd(iv);i++})},(100+timeDelay));timeDelay+=50});break;case'strip-left-fade':case'strip-right-fade':case'strip-top-fade':case'strip-bottom-fade':if(fx=='strip-left-fade'||fx=='strip-right-fade')iv.addStrips();else iv.addStrips(true);var timeDelay=0,i=0,strips=$('.iview-strip',iv.slider);if(fx=='strip-right-fade'||fx=='strip-bottom-fade')strips=$('.iview-strip',iv.slider).reverse();strips.each(function(){var strip=$(this);var width=strip.width();var height=strip.height();if(fx=='strip-left-fade'||fx=='strip-right-fade')strip.css({top:'0px',height:'100%',width:width});else strip.css({left:'0px',height:height,width:'100%'});setTimeout(function(){strip.animate({opacity:'1.0'},iv.options.animationSpeed*1.7,iv.defs.easing,function(){if(i==iv.options.strips-1)iv.transitionEnd(iv);i++})},(100+timeDelay));timeDelay+=35});break;case'slide-in-up':case'slide-in-down':opts={strips:1};iv.addStrips(false,opts);var strip=$('.iview-strip:first',iv.slider),top=0;if(fx=='slide-in-up')top='-'+iv.defs.height+'px';else top=iv.defs.height+'px';strip.css({top:top,'height':'100%','width':iv.defs.width});strip.animate({'top':'0px',opacity:1},(iv.options.animationSpeed*2),iv.defs.easing,function(){iv.transitionEnd(iv)});break;case'zigzag-top':case'zigzag-bottom':case'zigzag-grow-top':case'zigzag-grow-bottom':case'zigzag-drop-top':case'zigzag-drop-bottom':iv.addBlocks();var totalBlocks=(iv.options.blockCols*iv.options.blockRows),timeDelay=0,blockToArr=new Array(),blocks=$('.iview-block',iv.slider);for(var rows=0;rows=start;columns--){blockToArr.push($(blocks[columns]))}}else{for(var columns=start;columns=0&&Col=360){iv.cleanTimer();iv.goTo(false)}},setTimer:function(){var iv=this;iv.timer=setInterval(function(){iv.timerCall(iv)},(iv.defs.time/120))},cleanTimer:function(){var iv=this;clearInterval(iv.timer);iv.timer=null},goTo:function(action){var iv=this;if(iv.defs&&(iv.defs.slide==iv.defs.total-1)){iv.options.onLastSlide.call(this)}iv.cleanTimer();iv.iviewTimer.animate({opacity:0});iv.options.onBeforeChange.call(this);if(!action){iv.slider.css('background','url("'+iv.defs.image.data('iview:image')+'") no-repeat')}else{if(action=='prev'||action=='next'){iv.slider.css('background','url("'+iv.defs.image.data('iview:image')+'") no-repeat')}}iv.defs.slide++;if(iv.defs.slide==iv.defs.total){iv.defs.slide=0;iv.options.onSlideShowEnd.call(this)}if(iv.defs.slide<0)iv.defs.slide=(iv.defs.total-1);iv.defs.image=iv.slides.eq(iv.defs.slide);if(iv.options.controlNav){$('.iview-controlNav a.iview-control',iv.sliderContent).removeClass('active');$('.iview-controlNav a.iview-control:eq('+iv.defs.slide+')',iv.sliderContent).addClass('active')}var fx=iv.options.fx;if(iv.options.fx.toLowerCase()=='random'){var transitions=new Array('left-curtain','right-curtain','top-curtain','bottom-curtain','strip-down-right','strip-down-left','strip-up-right','strip-up-left','strip-up-down','strip-up-down-left','strip-left-right','strip-left-right-down','slide-in-right','slide-in-left','slide-in-up','slide-in-down','fade','block-random','block-fade','block-fade-reverse','block-expand','block-expand-reverse','block-expand-random','zigzag-top','zigzag-bottom','zigzag-grow-top','zigzag-grow-bottom','zigzag-drop-top','zigzag-drop-bottom','strip-left-fade','strip-right-fade','strip-top-fade','strip-bottom-fade','block-drop-random');fx=transitions[Math.floor(Math.random()*(transitions.length+1))];if(fx==undefined)fx='fade';fx=$.trim(fx.toLowerCase())}if(iv.options.fx.indexOf(',')!=-1){var transitions=iv.options.fx.split(',');fx=transitions[Math.floor(Math.random()*(transitions.length))];if(fx==undefined)fx='fade';fx=$.trim(fx.toLowerCase())}if(iv.defs.image.data('iview:transition')){var transitions=iv.defs.image.data('iview:transition').split(',');fx=transitions[Math.floor(Math.random()*(transitions.length))];fx=$.trim(fx.toLowerCase())}iv.defs.easing=(iv.defs.image.data('iview:easing'))?iv.defs.image.data('iview:easing'):iv.options.easing;iv.defs.lock=true;iv.runTransition(fx)},playSlider:function(){var iv=this;if(iv.timer==null&&iv.defs.paused){iv.iviewTimer.removeClass('paused').attr('title',iv.options.pauseLabel);iv.setTimer();iv.defs.paused=false;iv.options.onPlay.call(this)}},stopSlider:function(){var iv=this;iv.iviewTimer.addClass('paused').attr('title',iv.options.playLabel);iv.cleanTimer();iv.defs.paused=true;iv.options.onPause.call(this)},setTimerPosition:function(){var iv=this,position=iv.options.timerPosition.toLowerCase().split('-');for(var i=0;i$.event.special.swipe.scrollSupressionThreshold){event.preventDefault()}}$this.bind(touchMoveEvent,moveHandler).one(touchStopEvent,function(event){$this.unbind(touchMoveEvent,moveHandler);if(start&&stop){if(stop.time-start.time<$.event.special.swipe.durationThreshold&&Math.abs(start.coords[0]-stop.coords[0])>$.event.special.swipe.horizontalDistanceThreshold&&Math.abs(start.coords[1]-stop.coords[1])<$.event.special.swipe.verticalDistanceThreshold){start.origin.trigger("swipe").trigger(start.coords[0]>stop.coords[0]?"swipeleft":"swiperight")}}start=stop=undefined})})}};$.each({swipeleft:"swipe",swiperight:"swipe"},function(event,sourceEvent){$.event.special[event]={setup:function(){$(this).bind(sourceEvent,$.noop)}}})})(jQuery,this); From 9e871ab184451a7de7105e69aace7356952d2098 Mon Sep 17 00:00:00 2001 From: Ash Whiting Date: Fri, 23 Aug 2013 17:04:53 +0100 Subject: [PATCH 6/7] Added instructions to the readme Added instructions --- README.md | 325 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 325 insertions(+) diff --git a/README.md b/README.md index 482ec72..4d789ed 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,328 @@ iView ===== iView is easy to use jQuery image slider with animated captions, responsive layout and HTML Elements like (Video, iFrame) slider. Easily add unlimited number of slides and captions. Use it as image slider, image gallery, banner rotator, banner ads, or even presentation. + +A) Setup +===== + +Include the following javascript and css code into HEAD section of the page: + + + + + + + +Then insert into body section the slide (or slides) to which you want to apply the effect. + +
+ +
+ +
+
+You can add a caption to the slide, just put a div with class "iview-caption" into the div above: + +
+ +
+ +

The Responsive Caption

This is the product that you all have been waiting for!

Customize this slider with just a little HTML and CSS to your very needs. Give each slider some captions to transport your message.

All in all it works on every browser (including IE6 / 7 / 8) and on iOS and Android devices!
+
+ +
+ +
Caption Description
+
+
+By adding one more html5 data-attribute to the "iview-caption" div you can decide the effect of the caption. The possible effects are: "wipeLeft", "wipeRight", "wipeTop", "wipeBottom", "expandLeft", "expandRight", "expandTop", "expandBottom", "fade" + + +
Caption description
+A caption can have a data-transition "fade", in this case it will be displayed with a fading effect. +More HTML5 data-attributes avalable: + +Parameter Accepted values + +data-transition Transition type can be any one of the following: "wipeLeft", "wipeRight", "wipeTop", "wipeBottom", "expandLeft", "expandRight", "expandTop", "expandBottom", "fade" +data-easing for the complete list http://jqueryui.com/demos/effect/easing.html +data-speed Transition duration in milliseconds. +data-x Caption x position in pixel. +data-y Caption y position in pixel. +data-width Caption width in pixel, if not set will get the source caption width. +data-height Caption height in pixel, if not set will get the source caption height. + +VIDEOS +===== + +To include a video into your slideshow you must put an iframe into one of your slides: + + +
+ + + + +
Caption Description
+
+As you can see I set the width and the height of the iframe to 100%, so it changes its size according with the size of the slideshows (I mean the iframe, the video in the iframe will mantain its ratio). + +Finally you need to hook up your script using the $(document).ready() function: + + + +B) Available Parameters +===== + +The iView Slider has plenty of options to fiddle with. Below is an example of the code with all available options and their defaults: + + + + +The effect parameter can be any of the following: + +random +strip-down-right +strip-down-left +strip-up-right +strip-up-left +strip-up-down +strip-up-down-left +strip-left-right +strip-left-right-down +slide-in-right +slide-in-left +slide-in-up +slide-in-down +left-curtain +right-curtain +top-curtain +bottom-curtain +fade +block-random +block-fade +block-fade-reverse +block-expand +block-expand-reverse +block-expand-random +block-drop-random +zigzag-top +zigzag-bottom +zigzag-grow-top +zigzag-grow-bottom +zigzag-drop-top +zigzag-drop-bottom +strip-left-fade +strip-right-fade +strip-top-fade +strip-bottom-fade + +C) The HTML5 "data-" attributes +===== + +The URL of the image on the slide is added by using the HTML5 data- attribute. This allows to load the image only when the slideshow calls it and not (lazy load method). + +By using the HTML5 data- attribute you can add many properties to your slide, that overwrite the general ones. For instance the URL of the thumbnails: + +
+or a transition effect for one slide only: + +
+You can set a random transition between many effects: + +
+Here below you can see all the other "data-" possibilities: + +Parameter Accepted values +===== + +data-iview:transition Transition type can be any one of the following: "strip-down-right", "strip-down-left", "strip-up-right", "strip-up-left", "strip-up-down", "strip-up-down-left", "strip-left-right", "strip-left-right-down", "slide-in-right", "slide-in-left", "slide-in-up", "slide-in-down", "left-curtain", "right-curtain", "top-curtain", "bottom-curtain", "fade", "block-random", "block-fade", "block-fade-reverse", "block-expand", "block-expand-reverse", "block-expand-random", "block-drop-random", "zigzag-top", "zigzag-bottom", "zigzag-grow-top", "zigzag-grow-bottom", "zigzag-drop-top", "zigzag-drop-bottom", "strip-left-fade", "strip-right-fade", "strip-top-fade", "strip-bottom-fade" +data-iview:easing for the complete list http://jqueryui.com/demos/effect/easing.html +data-iview:image The URL of the image of the slide +data-iview:thumbnail The URL of the thumbnail of the slide (if the value of the 'controlNavThumbs' option is true) +data-iview:pausetime The milliseconds between the end of the sliding effect and the start of the next one +data-iview:type The type of the slide (set it to video to optimize slider for video show) + +D) CSS Styles and Structure +===== + +I'm using two CSS files in this sample. The first one contains some general styling, such as anchor tag colors, font-sizes, etc for the page. + +The second file contains all of the specific stylings for the script. Keep in mind, that these values might be overridden somewhere else in the file. The file is separated into sections using: + +/* The strips and blocks in the Slider */ +.iview-strip { + some styles +} +.iview-block { + some styles +} + +/* Direction nav styles (e.g. Next & Prev) */ +.iview-directionNav a { + some styles +} +.iview-prevNav { + some styles +} +.iview-nextNav { + some styles +} + +/* Control nav styles (e.g. 1,2,3...) */ +.iview-controlNav { + some styles +} +.iview-controlNav a { + some styles +} +.iview-controlNav a img { + some styles +} +.iview-controlNav a.active { + some styles +} + +/* The captions in the Slider */ +.iview-caption { + some styles +} + +/* The timer in the Slider */ +#iview-timer { + some styles +} + +#iview-timer div { + some styles +} + +/* The Preloader in the Slider */ +#iview-preloader { + some styles +} +#iview-preloader div { + some styles +} + +/* The video show in the Slider */ +.iview-video-show { + some styles +} +.iview-video-show .iview-video-container { + some styles +} +.iview-video-show .iview-video-container a.iview-video-close { + some styles +} +.iview-video-show .iview-video-container a.iview-video-close:hover { + some styles +} + + +/* The tooltip in the Slider */ +#iview-tooltip { + some styles +} + +#iview-tooltip div.holder { + some styles +} + +#iview-tooltip div.holder div.container { + some styles +} + +#iview-tooltip div.holder div.container div { + some styles +} + +#iview-tooltip div.holder div.container div img { + some styles +} + +E) JavaScript +===== + +How to pause and play the slider? + + +$('#slider').trigger('iView:pause'); //Stop the Slider +$('#slider').trigger('iView:play'); //Start the Slider + +How to change slide? + +$('#slider').trigger('iView:goSlide', [2]); //Go to slide 2 + +How to next and previous the slider? + + +$('#slider').trigger('iView:previous'); //Go to previous slide +$('#slider').trigger('iView:next'); //Go to next slide + +How to set a random starting slide? + +var total = $('#slider').children().length; +var rand = Math.floor(Math.random()*total); +$('#slider').iView({ + startSlide:rand +}); +Once again, thank you so much for choosing this script. As I said at the beginning, I'd be glad to help you if you have any questions relating to this script. From 826e220528d2ad7096acd0fa289576a4882b89f0 Mon Sep 17 00:00:00 2001 From: Ash Whiting Date: Fri, 23 Aug 2013 17:06:10 +0100 Subject: [PATCH 7/7] Update README.md --- README.md | 324 ------------------------------------------------------ 1 file changed, 324 deletions(-) diff --git a/README.md b/README.md index 4d789ed..64cda01 100644 --- a/README.md +++ b/README.md @@ -3,327 +3,3 @@ iView iView is easy to use jQuery image slider with animated captions, responsive layout and HTML Elements like (Video, iFrame) slider. Easily add unlimited number of slides and captions. Use it as image slider, image gallery, banner rotator, banner ads, or even presentation. -A) Setup -===== - -Include the following javascript and css code into HEAD section of the page: - - - - - - - -Then insert into body section the slide (or slides) to which you want to apply the effect. - -
- -
- -
-
-You can add a caption to the slide, just put a div with class "iview-caption" into the div above: - -
- -
- -

The Responsive Caption

This is the product that you all have been waiting for!

Customize this slider with just a little HTML and CSS to your very needs. Give each slider some captions to transport your message.

All in all it works on every browser (including IE6 / 7 / 8) and on iOS and Android devices!
-
- -
- -
Caption Description
-
-
-By adding one more html5 data-attribute to the "iview-caption" div you can decide the effect of the caption. The possible effects are: "wipeLeft", "wipeRight", "wipeTop", "wipeBottom", "expandLeft", "expandRight", "expandTop", "expandBottom", "fade" - - -
Caption description
-A caption can have a data-transition "fade", in this case it will be displayed with a fading effect. -More HTML5 data-attributes avalable: - -Parameter Accepted values - -data-transition Transition type can be any one of the following: "wipeLeft", "wipeRight", "wipeTop", "wipeBottom", "expandLeft", "expandRight", "expandTop", "expandBottom", "fade" -data-easing for the complete list http://jqueryui.com/demos/effect/easing.html -data-speed Transition duration in milliseconds. -data-x Caption x position in pixel. -data-y Caption y position in pixel. -data-width Caption width in pixel, if not set will get the source caption width. -data-height Caption height in pixel, if not set will get the source caption height. - -VIDEOS -===== - -To include a video into your slideshow you must put an iframe into one of your slides: - - -
- - - - -
Caption Description
-
-As you can see I set the width and the height of the iframe to 100%, so it changes its size according with the size of the slideshows (I mean the iframe, the video in the iframe will mantain its ratio). - -Finally you need to hook up your script using the $(document).ready() function: - - - -B) Available Parameters -===== - -The iView Slider has plenty of options to fiddle with. Below is an example of the code with all available options and their defaults: - - - - -The effect parameter can be any of the following: - -random -strip-down-right -strip-down-left -strip-up-right -strip-up-left -strip-up-down -strip-up-down-left -strip-left-right -strip-left-right-down -slide-in-right -slide-in-left -slide-in-up -slide-in-down -left-curtain -right-curtain -top-curtain -bottom-curtain -fade -block-random -block-fade -block-fade-reverse -block-expand -block-expand-reverse -block-expand-random -block-drop-random -zigzag-top -zigzag-bottom -zigzag-grow-top -zigzag-grow-bottom -zigzag-drop-top -zigzag-drop-bottom -strip-left-fade -strip-right-fade -strip-top-fade -strip-bottom-fade - -C) The HTML5 "data-" attributes -===== - -The URL of the image on the slide is added by using the HTML5 data- attribute. This allows to load the image only when the slideshow calls it and not (lazy load method). - -By using the HTML5 data- attribute you can add many properties to your slide, that overwrite the general ones. For instance the URL of the thumbnails: - -
-or a transition effect for one slide only: - -
-You can set a random transition between many effects: - -
-Here below you can see all the other "data-" possibilities: - -Parameter Accepted values -===== - -data-iview:transition Transition type can be any one of the following: "strip-down-right", "strip-down-left", "strip-up-right", "strip-up-left", "strip-up-down", "strip-up-down-left", "strip-left-right", "strip-left-right-down", "slide-in-right", "slide-in-left", "slide-in-up", "slide-in-down", "left-curtain", "right-curtain", "top-curtain", "bottom-curtain", "fade", "block-random", "block-fade", "block-fade-reverse", "block-expand", "block-expand-reverse", "block-expand-random", "block-drop-random", "zigzag-top", "zigzag-bottom", "zigzag-grow-top", "zigzag-grow-bottom", "zigzag-drop-top", "zigzag-drop-bottom", "strip-left-fade", "strip-right-fade", "strip-top-fade", "strip-bottom-fade" -data-iview:easing for the complete list http://jqueryui.com/demos/effect/easing.html -data-iview:image The URL of the image of the slide -data-iview:thumbnail The URL of the thumbnail of the slide (if the value of the 'controlNavThumbs' option is true) -data-iview:pausetime The milliseconds between the end of the sliding effect and the start of the next one -data-iview:type The type of the slide (set it to video to optimize slider for video show) - -D) CSS Styles and Structure -===== - -I'm using two CSS files in this sample. The first one contains some general styling, such as anchor tag colors, font-sizes, etc for the page. - -The second file contains all of the specific stylings for the script. Keep in mind, that these values might be overridden somewhere else in the file. The file is separated into sections using: - -/* The strips and blocks in the Slider */ -.iview-strip { - some styles -} -.iview-block { - some styles -} - -/* Direction nav styles (e.g. Next & Prev) */ -.iview-directionNav a { - some styles -} -.iview-prevNav { - some styles -} -.iview-nextNav { - some styles -} - -/* Control nav styles (e.g. 1,2,3...) */ -.iview-controlNav { - some styles -} -.iview-controlNav a { - some styles -} -.iview-controlNav a img { - some styles -} -.iview-controlNav a.active { - some styles -} - -/* The captions in the Slider */ -.iview-caption { - some styles -} - -/* The timer in the Slider */ -#iview-timer { - some styles -} - -#iview-timer div { - some styles -} - -/* The Preloader in the Slider */ -#iview-preloader { - some styles -} -#iview-preloader div { - some styles -} - -/* The video show in the Slider */ -.iview-video-show { - some styles -} -.iview-video-show .iview-video-container { - some styles -} -.iview-video-show .iview-video-container a.iview-video-close { - some styles -} -.iview-video-show .iview-video-container a.iview-video-close:hover { - some styles -} - - -/* The tooltip in the Slider */ -#iview-tooltip { - some styles -} - -#iview-tooltip div.holder { - some styles -} - -#iview-tooltip div.holder div.container { - some styles -} - -#iview-tooltip div.holder div.container div { - some styles -} - -#iview-tooltip div.holder div.container div img { - some styles -} - -E) JavaScript -===== - -How to pause and play the slider? - - -$('#slider').trigger('iView:pause'); //Stop the Slider -$('#slider').trigger('iView:play'); //Start the Slider - -How to change slide? - -$('#slider').trigger('iView:goSlide', [2]); //Go to slide 2 - -How to next and previous the slider? - - -$('#slider').trigger('iView:previous'); //Go to previous slide -$('#slider').trigger('iView:next'); //Go to next slide - -How to set a random starting slide? - -var total = $('#slider').children().length; -var rand = Math.floor(Math.random()*total); -$('#slider').iView({ - startSlide:rand -}); -Once again, thank you so much for choosing this script. As I said at the beginning, I'd be glad to help you if you have any questions relating to this script.