1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582 |
- /**
- * @preserve Flux Slider v1.4.4
- * http://www.joelambert.co.uk/flux
- *
- * Copyright 2011, Joe Lambert.
- * Free to use under the MIT license.
- * http://www.opensource.org/licenses/mit-license.php
- */
- // Flux namespace
- window.flux = {
- version: '1.4.4'
- };
- (function($){
- flux.slider = function(elem, opts) {
- // Setup the flux.browser singleton to perform feature detection
- flux.browser.init();
- if(!flux.browser.supportsTransitions)
- {
- if(window.console && window.console.error)
- console.error("Flux Slider requires a browser that supports CSS3 transitions");
- }
- var _this = this;
- this.element = $(elem);
- // Make a list of all available transitions
- this.transitions = [];
- for(var fx in flux.transitions)
- this.transitions.push(fx);
- this.options = $.extend({
- autoplay: true,
- transitions: this.transitions,
- delay: 4000,
- pagination: true,
- controls: false,
- captions: false,
- width: null,
- height: null,
- onTransitionEnd: null
- }, opts);
- // Set the height/width if given [EXPERIMENTAL!]
- this.height = this.options.height ? this.options.height : null;
- this.width = this.options.width ? this.options.width : null;
- // Filter out non compatible transitions
- var newTrans = [];
- $(this.options.transitions).each(function(index, tran){
- var t = new flux.transitions[tran](this),
- compatible = true;
-
- if(t.options.requires3d && !flux.browser.supports3d)
- compatible = false;
-
- if(t.options.compatibilityCheck)
- compatible = t.options.compatibilityCheck();
- if(compatible)
- newTrans.push(tran);
- });
- this.options.transitions = newTrans;
- this.images = new Array();
- this.imageLoadedCount = 0;
- this.currentImageIndex = 0;
- this.nextImageIndex = 1;
- this.playing = false;
- this.container = $('<div class="fluxslider"></div>').appendTo(this.element);
-
- this.surface = $('<div class="surface" style="position: relative"></div>').appendTo(this.container);
-
- // Listen for click events as we may want to follow a link
- this.container.bind('click', function(event) {
- if($(event.target).hasClass('hasLink'))
- window.location = $(event.target).data('href');
- });
- this.imageContainer = $('<div class="images loading"></div>').css({
- 'position': 'relative',
- 'overflow': 'hidden',
- 'min-height': '100px'
- }).appendTo(this.surface);
-
- // If the height/width is already set then resize the container
- if(this.width && this.height)
- {
- this.imageContainer.css({
- width: this.width+'px',
- height: this.height+'px'
- });
- }
- // Create the placeholders for the current and next image
- this.image1 = $('<div class="image1" style="height: 100%; width: 100%"></div>').appendTo(this.imageContainer);
- this.image2 = $('<div class="image2" style="height: 100%; width: 100%"></div>').appendTo(this.imageContainer);
- $(this.image1).add(this.image2).css({
- 'position': 'absolute',
- 'top': '0px',
- 'left': '0px'
- });
-
- // Get a list of the images to use
- this.element.find('img, a img').each(function(index, found_img){
- var imgClone = found_img.cloneNode(false),
- link = $(found_img).parent();
- // If this img is directly inside a link then save the link for later use
- if(link.is('a'))
- $(imgClone).data('href', link.attr('href'));
- _this.images.push(imgClone);
- // Remove the images from the DOM
- $(found_img).remove();
- });
-
- // Load the images afterwards as IE seems to load images synchronously
- for(var i=0; i<this.images.length; i++) {
- var image = new Image();
- image.onload = function() {
- _this.imageLoadedCount++;
- _this.width = _this.width ? _this.width : this.width;
- _this.height = _this.height ? _this.height : this.height;
- if(_this.imageLoadedCount >= _this.images.length)
- {
- _this.finishedLoading();
- _this.setupImages();
- }
- };
- // Load the image to ensure its cached by the browser
- image.src = this.images[i].src;
- }
-
- // Catch when a transition has finished
- this.element.bind('fluxTransitionEnd', function(event, data) {
- // If the slider is currently playing then set the timeout for the next transition
- // if(_this.isPlaying())
- // _this.start();
-
- // Are we using a callback instead of events for notifying about transition ends?
- if(_this.options.onTransitionEnd) {
- event.preventDefault();
- _this.options.onTransitionEnd(data);
- }
- });
- // Should we auto start the slider?
- if(this.options.autoplay)
- this.start();
-
- // Handle swipes
- this.element.bind('swipeLeft', function(event){
- _this.next(null, {direction: 'left'});
- }).bind('swipeRight', function(event){
- _this.prev(null, {direction: 'right'});
- });
-
- // Under FF7 autoplay breaks when the current tab loses focus
- setTimeout(function(){
- $(window).focus(function(){
- if(_this.isPlaying())
- _this.next();
- });
- }, 100);
- };
- flux.slider.prototype = {
- constructor: flux.slider,
- playing: false,
- start: function() {
- var _this = this;
- this.playing = true;
- this.interval = setInterval(function() {
- console.log('play');
- _this.transition();
- }, this.options.delay);
- },
- stop: function() {
- this.playing = false;
- clearInterval(this.interval);
- this.interval = null;
- },
- isPlaying: function() {
- return this.playing;
- //return this.interval != null;
- },
- next: function(trans, opts) {
- opts = opts || {};
- opts.direction = 'left';
- this.showImage(this.currentImageIndex+1, trans, opts);
- },
- prev: function(trans, opts) {
- opts = opts || {};
- opts.direction = 'right';
- this.showImage(this.currentImageIndex-1, trans, opts);
- },
- showImage: function(index, trans, opts) {
- this.setNextIndex(index);
-
- // Temporarily stop the transition interval
- //clearInterval(this.interval);
- //this.interval = null;
-
- this.setupImages();
- this.transition(trans, opts);
- },
- finishedLoading: function() {
- var _this = this;
- this.container.css({
- width: this.width+'px',
- height: this.height+'px'
- });
- this.imageContainer.removeClass('loading');
- // Should we setup a pagination view?
- if(this.options.pagination)
- {
- // TODO: Attach to touch events if appropriate
- this.pagination = $('<ul class="pagination"></ul>').css({
- margin: '0px',
- padding: '0px',
- 'text-align': 'center'
- });
- this.pagination.bind('click', function(event){
- event.preventDefault();
- _this.showImage($(event.target).data('index'));
- });
- $(this.images).each(function(index, image){
- var li = $('<li data-index="'+index+'">'+(index+1)+'</li>').css({
- display: 'inline-block',
- 'margin-left': '0.5em',
- 'cursor': 'pointer'
- }).appendTo(_this.pagination);
- if(index == 0)
- li.css('margin-left', 0).addClass('current');
- });
- this.container.append(this.pagination);
- }
- // Resize
- $(this.imageContainer).css({
- width: this.width+'px',
- height: this.height+'px'
- });
- $(this.image1).css({
- width: this.width+'px',
- height: this.height+'px'
- });
- $(this.image2).css({
- width: this.width+'px',
- height: this.height+'px'
- });
- this.container.css({
- width: this.width+'px',
- height: this.height+(this.options.pagination?this.pagination.height():0)+'px'
- });
-
- // Should we add prev/next controls?
- if(this.options.controls)
- {
- var css = {
- padding: '4px 10px 10px',
- 'font-size': '60px',
- 'font-family': 'arial, sans-serif',
- 'line-height': '1em',
- 'font-weight': 'bold',
- color: '#FFF',
- 'text-decoration': 'none',
- background: 'rgba(0,0,0,0.5)',
- position: 'absolute',
- 'z-index': 2000
- };
-
- this.nextButton = $('<a href="#">»</a>').css(css).css3({
- 'border-radius': '4px'
- }).appendTo(this.surface).bind('click', function(event){
- event.preventDefault();
- _this.next();
- });
-
- this.prevButton = $('<a href="#">«</a>').css(css).css3({
- 'border-radius': '4px'
- }).appendTo(this.surface).bind('click', function(event){
- event.preventDefault();
- _this.prev();
- });
-
- var top = (this.height - this.nextButton.height())/2;
- this.nextButton.css({
- top: top+'px',
- right: '10px'
- });
-
- this.prevButton.css({
- top: top+'px',
- left: '10px'
- });
- }
-
- // Should we use captions?
- if(this.options.captions)
- {
- this.captionBar = $('<div class="caption"></div>').css({
- background: 'rgba(0,0,0,0.6)',
- color: '#FFF',
- 'font-size': '16px',
- 'font-family': 'helvetica, arial, sans-serif',
- 'text-decoration': 'none',
- 'font-weight': 'bold',
- padding: '1.5em 1em',
- opacity: 0,
- position: 'absolute',
- 'z-index': 110,
- width: '100%',
- bottom: 0
- }).css3({
- 'transition-property': 'opacity',
- 'transition-duration': '800ms',
- 'box-sizing': 'border-box'
- }).prependTo(this.surface);
- }
-
- this.updateCaption();
- },
- setupImages: function() {
- var img1 = this.getImage(this.currentImageIndex),
- css1 = {
- 'background-image': 'url("'+img1.src+'")',
- 'z-index': 101,
- 'cursor': 'auto'
- };
- // Does this image have an associated link?
- if($(img1).data('href'))
- {
- css1.cursor = 'pointer';
- this.image1.addClass('hasLink');
- this.image1.data('href', $(img1).data('href'));
- }
- else
- {
- this.image1.removeClass('hasLink');
- this.image1.data('href', null);
- }
- this.image1.css(css1).children().remove();
- this.image2.css({
- 'background-image': 'url("'+this.getImage(this.nextImageIndex).src+'")',
- 'z-index': 100
- }).show();
- if(this.options.pagination && this.pagination)
- {
- this.pagination.find('li.current').removeClass('current');
- $(this.pagination.find('li')[this.currentImageIndex]).addClass('current');
- }
- },
- transition: function(transition, opts) {
- // Allow a transition to be picked from ALL available transitions (not just the reduced set)
- if(transition == undefined || !flux.transitions[transition])
- {
- // Pick a transition at random from the (possibly reduced set of) transitions
- var index = Math.floor(Math.random()*(this.options.transitions.length));
- transition = this.options.transitions[index];
- }
-
- var tran = null;
- try {
- tran = new flux.transitions[transition](this, $.extend(this.options[transition] ? this.options[transition] : {}, opts));
- }
- catch(e) {
- // If an invalid transition has been provided then use the fallback (default is to just switch the image)
- tran = new flux.transition(this, {fallback: true});
- }
- tran.run();
-
- this.currentImageIndex = this.nextImageIndex;
- this.setNextIndex(this.currentImageIndex+1);
- this.updateCaption();
- },
- updateCaption: function() {
- var str = $(this.getImage(this.currentImageIndex)).attr('title');
- if(this.options.captions && this.captionBar)
- {
- if(str !== "")
- this.captionBar.html(str);
-
- this.captionBar.css('opacity', str === "" ? 0 : 1);
- }
- },
- getImage: function(index) {
- index = index % this.images.length;
- return this.images[index];
- },
- setNextIndex: function(nextIndex)
- {
- if(nextIndex == undefined)
- nextIndex = this.currentImageIndex+1;
- this.nextImageIndex = nextIndex;
- if(this.nextImageIndex > this.images.length-1)
- this.nextImageIndex = 0;
- if(this.nextImageIndex < 0)
- this.nextImageIndex = this.images.length-1;
- },
- increment: function() {
- this.currentImageIndex++;
- if(this.currentImageIndex > this.images.length-1)
- this.currentImageIndex = 0;
- }
- };
- })(window.jQuery || window.Zepto);
- /**
- * Helper object to determine support for various CSS3 functions
- * @author Joe Lambert
- */
- (function($) {
- flux.browser = {
- init: function() {
- // Have we already been initialised?
- if(flux.browser.supportsTransitions !== undefined)
- return;
- var div = document.createElement('div'),
- prefixes = ['-webkit', '-moz', '-o', '-ms'],
- domPrefixes = ['Webkit', 'Moz', 'O', 'Ms'];
- // Does the current browser support CSS Transitions?
- if(window.Modernizr && Modernizr.csstransitions !== undefined)
- flux.browser.supportsTransitions = Modernizr.csstransitions;
- else
- {
- flux.browser.supportsTransitions = this.supportsCSSProperty('Transition');
- }
- // Does the current browser support 3D CSS Transforms?
- if(window.Modernizr && Modernizr.csstransforms3d !== undefined)
- flux.browser.supports3d = Modernizr.csstransforms3d;
- else
- {
- // Custom detection when Modernizr isn't available
- flux.browser.supports3d = this.supportsCSSProperty("Perspective");
-
- if ( flux.browser.supports3d && 'webkitPerspective' in $('body').get(0).style ) {
- // Double check with a media query (similar to how Modernizr does this)
- var div3D = $('<div id="csstransform3d"></div>');
- var mq = $('<style media="(transform-3d), ('+prefixes.join('-transform-3d),(')+'-transform-3d)">div#csstransform3d { position: absolute; left: 9px }</style>');
- $('body').append(div3D);
- $('head').append(mq);
- flux.browser.supports3d = div3D.get(0).offsetLeft == 9;
- div3D.remove();
- mq.remove();
- }
- }
- },
- supportsCSSProperty: function(prop) {
- var div = document.createElement('div'),
- prefixes = ['-webkit', '-moz', '-o', '-ms'],
- domPrefixes = ['Webkit', 'Moz', 'O', 'Ms'];
-
- var support = false;
- for(var i=0; i<domPrefixes.length; i++)
- {
- if(domPrefixes[i]+prop in div.style)
- support = support || true;
- }
-
- return support;
- },
- translate: function(x, y, z) {
- x = (x != undefined) ? x : 0;
- y = (y != undefined) ? y : 0;
- z = (z != undefined) ? z : 0;
- return 'translate' + (flux.browser.supports3d ? '3d(' : '(') + x + 'px,' + y + (flux.browser.supports3d ? 'px,' + z + 'px)' : 'px)');
- },
- rotateX: function(deg) {
- return flux.browser.rotate('x', deg);
- },
- rotateY: function(deg) {
- return flux.browser.rotate('y', deg);
- },
- rotateZ: function(deg) {
- return flux.browser.rotate('z', deg);
- },
- rotate: function(axis, deg) {
- if(!axis in {'x':'', 'y':'', 'z':''})
- axis = 'z';
- deg = (deg != undefined) ? deg : 0;
- if(flux.browser.supports3d)
- return 'rotate3d('+(axis == 'x' ? '1' : '0')+', '+(axis == 'y' ? '1' : '0')+', '+(axis == 'z' ? '1' : '0')+', '+deg+'deg)';
- else
- {
- if(axis == 'z')
- return 'rotate('+deg+'deg)';
- else
- return '';
- }
- }
- };
- $(function(){
- // To continue to work with legacy code, ensure that flux.browser is initialised on document ready at the latest
- flux.browser.init();
- });
- })(window.jQuery || window.Zepto);
- (function($){
- /**
- * Helper function for cross-browser CSS3 support, prepends all possible prefixes to all properties passed in
- * @param {Object} props Ker/value pairs of CSS3 properties
- */
- $.fn.css3 = function(props) {
- var css = {};
- var prefixes = ['webkit', 'moz', 'ms', 'o'];
- for(var prop in props)
- {
- // Add the vendor specific versions
- for(var i=0; i<prefixes.length; i++)
- css['-'+prefixes[i]+'-'+prop] = props[prop];
-
- // Add the actual version
- css[prop] = props[prop];
- }
-
- this.css(css);
- return this;
- };
-
- /**
- * Helper function to bind to the correct transition end event
- * @param {function} callback The function to call when the event fires
- */
- $.fn.transitionEnd = function(callback) {
- var _this = this;
-
- var events = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd'];
-
- for(var i=0; i < events.length; i++)
- {
- this.bind(events[i], function(event){
- // Automatically stop listening for the event
- for(var j=0; j<events.length;j++)
- $(this).unbind(events[j]);
- // Perform the callback function
- if(callback)
- callback.call(this, event);
- });
- }
-
- return this;
- };
- flux.transition = function(fluxslider, opts) {
- this.options = $.extend({
- requires3d: false,
- after: function() {
- // Default callback for after the transition has completed
- }
- }, opts);
- this.slider = fluxslider;
- // We need to ensure transitions degrade gracefully if the transition is unsupported or not loaded
- if((this.options.requires3d && !flux.browser.supports3d) || !flux.browser.supportsTransitions || this.options.fallback === true)
- {
- var _this = this;
-
- this.options.after = undefined;
- this.options.setup = function() {
- //console.error("Fallback setup()");
- _this.fallbackSetup();
- };
-
- this.options.execute = function() {
- //console.error("Fallback execute()");
- _this.fallbackExecute();
- };
- }
- };
- flux.transition.prototype = {
- constructor: flux.transition,
- hasFinished: false, // This is a lock to ensure that the fluxTransitionEnd event is only fired once per tansition
- run: function() {
- var _this = this;
- // do something
- if(this.options.setup !== undefined)
- this.options.setup.call(this);
-
- // Remove the background image from the top image
- this.slider.image1.css({
- 'background-image': 'none'
- });
- this.slider.imageContainer.css('overflow', this.options.requires3d ? 'visible' : 'hidden');
- // For some of the 3D effects using Zepto we need to delay the transitions for some reason
- setTimeout(function(){
- if(_this.options.execute !== undefined)
- _this.options.execute.call(_this);
- }, 5);
- },
- finished: function() {
- if(this.hasFinished)
- return;
-
- this.hasFinished = true;
-
- if(this.options.after)
- this.options.after.call(this);
- this.slider.imageContainer.css('overflow', 'hidden');
- this.slider.setupImages();
- // Trigger an event to signal the end of a transition
- this.slider.element.trigger('fluxTransitionEnd', {
- currentImage: this.slider.getImage(this.slider.currentImageIndex)
- });
- },
- fallbackSetup: function() {
-
- },
- fallbackExecute: function() {
- this.finished();
- }
- };
- flux.transitions = {};
-
- // Flux grid transition
-
- flux.transition_grid = function(fluxslider, opts) {
- return new flux.transition(fluxslider, $.extend({
- columns: 6,
- rows: 6,
- forceSquare: false,
- setup: function() {
- var imgWidth = this.slider.image1.width(),
- imgHeight = this.slider.image1.height();
-
- var colWidth = Math.floor(imgWidth / this.options.columns),
- rowHeight = Math.floor(imgHeight / this.options.rows);
-
- if(this.options.forceSquare)
- {
- rowHeight = colWidth;
- this.options.rows = Math.floor(imgHeight / rowHeight);
- }
- // Work out how much space remains with the adjusted barWidth
- var colRemainder = imgWidth - (this.options.columns * colWidth),
- colAddPerLoop = Math.ceil(colRemainder / this.options.columns),
-
- rowRemainder = imgHeight - (this.options.rows * rowHeight),
- rowAddPerLoop = Math.ceil(rowRemainder / this.options.rows),
-
- delayBetweenBars = 150,
- height = this.slider.image1.height(),
- totalLeft = 0,
- totalTop = 0,
- fragment = document.createDocumentFragment();
-
- for(var i=0; i<this.options.columns; i++) {
- var thisColWidth = colWidth,
- totalTop = 0;
- if(colRemainder > 0)
- {
- var add = colRemainder >= colAddPerLoop ? colAddPerLoop : colRemainder;
- thisColWidth += add;
- colRemainder -= add;
- }
-
- for(var j=0; j<this.options.rows; j++)
- {
- var thisRowHeight = rowHeight,
- thisRowRemainder = rowRemainder;
- if(thisRowRemainder > 0)
- {
- var add = thisRowRemainder >= rowAddPerLoop ? rowAddPerLoop : thisRowRemainder;
- thisRowHeight += add;
- thisRowRemainder -= add;
- }
-
- var tile = $('<div class="tile tile-'+i+'-'+j+'"></div>').css({
- width: thisColWidth+'px',
- height: thisRowHeight+'px',
- position: 'absolute',
- top: totalTop+'px',
- left: totalLeft+'px'
- });
-
- this.options.renderTile.call(this, tile, i, j, thisColWidth, thisRowHeight, totalLeft, totalTop);
-
- fragment.appendChild(tile.get(0));
-
- totalTop += thisRowHeight;
- }
-
- totalLeft += thisColWidth;
- }
- // Append the fragement to the surface
- this.slider.image1.get(0).appendChild(fragment);
- },
- execute: function() {
- var _this = this,
- height = this.slider.image1.height(),
- bars = this.slider.image1.find('div.barcontainer');
- this.slider.image2.hide();
- // Get notified when the last transition has completed
- bars.last().transitionEnd(function(event){
- _this.slider.image2.show();
- _this.finished();
- });
- bars.css3({
- 'transform': flux.browser.rotateX(-90) + ' ' + flux.browser.translate(0, height/2, height/2)
- });
- },
- renderTile: function(elem, colIndex, rowIndex, colWidth, rowHeight, leftOffset, topOffset) {
-
- }
- }, opts));
- };
- })(window.jQuery || window.Zepto);
- (function($) {
- flux.transitions.bars = function(fluxslider, opts) {
- return new flux.transition_grid(fluxslider, $.extend({
- columns: 10,
- rows: 1,
- delayBetweenBars: 40,
- renderTile: function(elem, colIndex, rowIndex, colWidth, rowHeight, leftOffset, topOffset) {
- $(elem).css({
- 'background-image': this.slider.image1.css('background-image'),
- 'background-position': '-'+leftOffset+'px 0px'
- }).css3({
- 'transition-duration': '400ms',
- 'transition-timing-function': 'ease-in',
- 'transition-property': 'all',
- 'transition-delay': (colIndex*this.options.delayBetweenBars)+'ms'
- });
- },
- execute: function() {
- var _this = this;
-
- var height = this.slider.image1.height();
-
- var bars = this.slider.image1.find('div.tile');
-
- // Get notified when the last transition has completed
- $(bars[bars.length-1]).transitionEnd(function(){
- _this.finished();
- });
-
- setTimeout(function(){
- bars.css({
- 'opacity': '0.5'
- }).css3({
- 'transform': flux.browser.translate(0, height)
- });
- }, 50);
-
- }
- }, opts));
- };
- })(window.jQuery || window.Zepto);
- (function($) {
- flux.transitions.bars3d = function(fluxslider, opts) {
- return new flux.transition_grid(fluxslider, $.extend({
- requires3d: true,
- columns: 7,
- rows: 1,
- delayBetweenBars: 150,
- perspective: 1000,
- renderTile: function(elem, colIndex, rowIndex, colWidth, rowHeight, leftOffset, topOffset) {
- var bar = $('<div class="bar-'+colIndex+'"></div>').css({
- width: colWidth+'px',
- height: '100%',
- position: 'absolute',
- top: '0px',
- left: '0px',
- 'z-index': 200,
- 'background-image': this.slider.image1.css('background-image'),
- 'background-position': '-'+leftOffset+'px 0px',
- 'background-repeat': 'no-repeat'
- }).css3({
- 'backface-visibility': 'hidden'
- }),
- bar2 = $(bar.get(0).cloneNode(false)).css({
- 'background-image': this.slider.image2.css('background-image')
- }).css3({
- 'transform': flux.browser.rotateX(90) + ' ' + flux.browser.translate(0, -rowHeight/2, rowHeight/2)
- }),
- left = $('<div class="side bar-'+colIndex+'"></div>').css({
- width: rowHeight+'px',
- height: rowHeight+'px',
- position: 'absolute',
- top: '0px',
- left: '0px',
- background: '#222',
- 'z-index': 190
- }).css3({
- 'transform': flux.browser.rotateY(90) + ' ' + flux.browser.translate(rowHeight/2, 0, -rowHeight/2) + ' ' + flux.browser.rotateY(180),
- 'backface-visibility': 'hidden'
- }),
- right = $(left.get(0).cloneNode(false)).css3({
- 'transform': flux.browser.rotateY(90) + ' ' + flux.browser.translate(rowHeight/2, 0, colWidth-rowHeight/2)
- });
- $(elem).css({
- width: colWidth+'px',
- height: '100%',
- position: 'absolute',
- top: '0px',
- left: leftOffset+'px',
- 'z-index': colIndex > this.options.columns/2 ? 1000-colIndex : 1000 // Fix for Chrome to ensure that the z-index layering is correct!
- }).css3({
- 'transition-duration': '800ms',
- 'transition-timing-function': 'linear',
- 'transition-property': 'all',
- 'transition-delay': (colIndex*this.options.delayBetweenBars)+'ms',
- 'transform-style': 'preserve-3d'
- }).append(bar).append(bar2).append(left).append(right);
- },
- execute: function() {
- this.slider.image1.css3({
- 'perspective': this.options.perspective,
- 'perspective-origin': '50% 50%'
- }).css({
- '-moz-transform': 'perspective('+this.options.perspective+'px)',
- '-moz-perspective': 'none',
- '-moz-transform-style': 'preserve-3d'
- });
-
- var _this = this,
- height = this.slider.image1.height(),
- bars = this.slider.image1.find('div.tile');
- this.slider.image2.hide();
- // Get notified when the last transition has completed
- bars.last().transitionEnd(function(event){
- _this.slider.image1.css3({
- 'transform-style': 'flat'
- });
-
- _this.slider.image2.show();
- _this.finished();
- });
-
- setTimeout(function(){
- bars.css3({
- 'transform': flux.browser.rotateX(-90) + ' ' + flux.browser.translate(0, height/2, height/2)
- });
- }, 50);
- }
- }, opts));
- };
- })(window.jQuery || window.Zepto);
- (function($) {
- flux.transitions.blinds = function(fluxslider, opts) {
- return new flux.transitions.bars(fluxslider, $.extend({
- execute: function() {
- var _this = this;
- var height = this.slider.image1.height();
- var bars = this.slider.image1.find('div.tile');
- // Get notified when the last transition has completed
- $(bars[bars.length-1]).transitionEnd(function(){
- _this.finished();
- });
-
- setTimeout(function(){
- bars.css({
- 'opacity': '0.5'
- }).css3({
- 'transform': 'scalex(0.0001)'
- });
- }, 50);
- }
- }, opts));
- }
- })(window.jQuery || window.Zepto);
- (function($) {
- flux.transitions.blinds3d = function(fluxslider, opts) {
- return new flux.transitions.tiles3d(fluxslider, $.extend({
- forceSquare: false,
- rows: 1,
- columns: 6
- }, opts));
- };
- })(window.jQuery || window.Zepto);
- (function($) {
- flux.transitions.zip = function(fluxslider, opts) {
- return new flux.transitions.bars(fluxslider, $.extend({
- execute: function() {
- var _this = this;
- var height = this.slider.image1.height();
- var bars = this.slider.image1.find('div.tile');
- // Get notified when the last transition has completed
- $(bars[bars.length-1]).transitionEnd(function(){
- _this.finished();
- });
-
- setTimeout(function(){
- bars.each(function(index, bar){
- $(bar).css({
- 'opacity': '0.3'
- }).css3({
- 'transform': flux.browser.translate(0, (index%2 ? '-'+(2*height) : height))
- });
- });
- }, 20);
- }
- }, opts));
- };
- })(window.jQuery || window.Zepto);
- (function($) {
- flux.transitions.blocks = function(fluxslider, opts) {
- return new flux.transition_grid(fluxslider, $.extend({
- forceSquare: true,
- delayBetweenBars: 100,
- renderTile: function(elem, colIndex, rowIndex, colWidth, rowHeight, leftOffset, topOffset) {
- var delay = Math.floor(Math.random()*10*this.options.delayBetweenBars);
-
- $(elem).css({
- 'background-image': this.slider.image1.css('background-image'),
- 'background-position': '-'+leftOffset+'px -'+topOffset+'px'
- }).css3({
- 'transition-duration': '350ms',
- 'transition-timing-function': 'ease-in',
- 'transition-property': 'all',
- 'transition-delay': delay+'ms'
- });
-
- // Keep track of the last elem to fire
- if(this.maxDelay === undefined)
- this.maxDelay = 0;
-
- if(delay > this.maxDelay)
- {
- this.maxDelay = delay;
- this.maxDelayTile = elem;
- }
- },
- execute: function() {
- var _this = this;
-
- var blocks = this.slider.image1.find('div.tile');
-
- // Get notified when the last transition has completed
- this.maxDelayTile.transitionEnd(function(){
- _this.finished();
- });
-
- setTimeout(function(){
- blocks.each(function(index, block){
- $(block).css({
- 'opacity': '0'
- }).css3({
- 'transform': 'scale(0.8)'
- });
- });
- }, 50);
- }
- }, opts));
- };
- })(window.jQuery || window.Zepto);
- (function($) {
- flux.transitions.blocks2 = function(fluxslider, opts) {
- return new flux.transition_grid(fluxslider, $.extend({
- cols: 12,
- forceSquare: true,
- delayBetweenDiagnols: 150,
- renderTile: function(elem, colIndex, rowIndex, colWidth, rowHeight, leftOffset, topOffset) {
- var delay = Math.floor(Math.random()*10*this.options.delayBetweenBars);
-
- $(elem).css({
- 'background-image': this.slider.image1.css('background-image'),
- 'background-position': '-'+leftOffset+'px -'+topOffset+'px'
- }).css3({
- 'transition-duration': '350ms',
- 'transition-timing-function': 'ease-in',
- 'transition-property': 'all',
- 'transition-delay': (colIndex+rowIndex)*this.options.delayBetweenDiagnols+'ms',
- 'backface-visibility': 'hidden' // trigger hardware acceleration
- });
- },
- execute: function() {
- var _this = this;
-
- var blocks = this.slider.image1.find('div.tile');
-
- // Get notified when the last transition has completed
- blocks.last().transitionEnd(function(){
- _this.finished();
- });
-
- setTimeout(function(){
- blocks.each(function(index, block){
- $(block).css({
- 'opacity': '0'
- }).css3({
- 'transform': 'scale(0.8)'
- });
- });
- }, 50);
- }
- }, opts));
- };
- })(window.jQuery || window.Zepto);
- (function($) {
- flux.transitions.concentric = function(fluxslider, opts) {
- return new flux.transition(fluxslider, $.extend({
- blockSize: 60,
- delay: 150,
- alternate: false,
- setup: function() {
- var w = this.slider.image1.width(),
- h = this.slider.image1.height(),
- largestLength = Math.sqrt(w*w + h*h), // Largest length is the diagonal
- // How many blocks do we need?
- blockCount = Math.ceil(((largestLength-this.options.blockSize)/2) / this.options.blockSize) + 1, // 1 extra to account for the round border
- fragment = document.createDocumentFragment();
- for(var i=0; i<blockCount; i++)
- {
- var thisBlockSize = (2*i*this.options.blockSize)+this.options.blockSize;
- var block = $('<div></div>').attr('class', 'block block-'+i).css({
- width: thisBlockSize+'px',
- height: thisBlockSize+'px',
- position: 'absolute',
- top: ((h-thisBlockSize)/2)+'px',
- left: ((w-thisBlockSize)/2)+'px',
- 'z-index': 100+(blockCount-i),
- 'background-image': this.slider.image1.css('background-image'),
- 'background-position': 'center center'
- }).css3({
- 'border-radius': thisBlockSize+'px',
- 'transition-duration': '800ms',
- 'transition-timing-function': 'linear',
- 'transition-property': 'all',
- 'transition-delay': ((blockCount-i)*this.options.delay)+'ms'
- });
- fragment.appendChild(block.get(0));
- }
- //this.slider.image1.append($(fragment));
- this.slider.image1.get(0).appendChild(fragment);
- },
- execute: function() {
- var _this = this;
- var blocks = this.slider.image1.find('div.block');
- // Get notified when the last transition has completed
- $(blocks[0]).transitionEnd(function(){
- _this.finished();
- });
- setTimeout(function(){
- blocks.each(function(index, block){
- $(block).css({
- 'opacity': '0'
- }).css3({
- 'transform': flux.browser.rotateZ((!_this.options.alternate || index%2 ? '' : '-')+'90')
- });
- });
- }, 50);
- }
- }, opts));
- };
- })(window.jQuery || window.Zepto);
- (function($) {
- flux.transitions.warp = function(fluxslider, opts) {
- return new flux.transitions.concentric(fluxslider, $.extend({
- delay: 30,
- alternate: true
- }, opts));
- };
- })(window.jQuery || window.Zepto);
- (function($) {
- flux.transitions.cube = function(fluxslider, opts) {
- return new flux.transition(fluxslider, $.extend({
- requires3d: true,
- barWidth: 100,
- direction: 'left',
- perspective: 1000,
- setup: function() {
- var width = this.slider.image1.width();
- var height = this.slider.image1.height();
- // Setup the container to allow 3D perspective
- this.slider.image1.css3({
- 'perspective': this.options.perspective,
- 'perspective-origin': '50% 50%'
- });
- this.cubeContainer = $('<div class="cube"></div>').css({
- width: width+'px',
- height: height+'px',
- position: 'relative'
- }).css3({
- 'transition-duration': '800ms',
- 'transition-timing-function': 'linear',
- 'transition-property': 'all',
- 'transform-style': 'preserve-3d'
- });
- var css = {
- height: '100%',
- width: '100%',
- position: 'absolute',
- top: '0px',
- left: '0px'
- };
- var currentFace = $('<div class="face current"></div>').css($.extend(css, {
- background: this.slider.image1.css('background-image')
- })).css3({
- 'backface-visibility': 'hidden'
- });
- this.cubeContainer.append(currentFace);
- var nextFace = $('<div class="face next"></div>').css($.extend(css, {
- background: this.slider.image2.css('background-image')
- })).css3({
- 'transform' : this.options.transitionStrings.call(this, this.options.direction, 'nextFace'),
- 'backface-visibility': 'hidden'
- });
- this.cubeContainer.append(nextFace);
- this.slider.image1.append(this.cubeContainer);
- },
- execute: function() {
- var _this = this;
- var width = this.slider.image1.width();
- var height = this.slider.image1.height();
- this.slider.image2.hide();
- this.cubeContainer.transitionEnd(function(){
- _this.slider.image2.show();
- _this.finished();
- });
-
- setTimeout(function(){
- _this.cubeContainer.css3({
- 'transform' : _this.options.transitionStrings.call(_this, _this.options.direction, 'container')
- });
- }, 50);
- },
- transitionStrings: function(direction, elem) {
- var width = this.slider.image1.width();
- var height = this.slider.image1.height();
- // Define the various transforms that are required to perform various cube rotations
- var t = {
- 'up' : {
- 'nextFace': flux.browser.rotateX(-90) + ' ' + flux.browser.translate(0, height/2, height/2),
- 'container': flux.browser.rotateX(90) + ' ' + flux.browser.translate(0, -height/2, height/2)
- },
- 'down' : {
- 'nextFace': flux.browser.rotateX(90) + ' ' + flux.browser.translate(0, -height/2, height/2),
- 'container': flux.browser.rotateX(-90) + ' ' + flux.browser.translate(0, height/2, height/2)
- },
- 'left' : {
- 'nextFace': flux.browser.rotateY(90) + ' ' + flux.browser.translate(width/2, 0, width/2),
- 'container': flux.browser.rotateY(-90) + ' ' + flux.browser.translate(-width/2, 0, width/2)
- },
- 'right' : {
- 'nextFace': flux.browser.rotateY(-90) + ' ' + flux.browser.translate(-width/2, 0, width/2),
- 'container': flux.browser.rotateY(90) + ' ' + flux.browser.translate(width/2, 0, width/2)
- }
- };
- return (t[direction] && t[direction][elem]) ? t[direction][elem] : false;
- }
- }, opts));
- };
- })(window.jQuery || window.Zepto);
- (function($) {
- flux.transitions.tiles3d = function(fluxslider, opts) {
- return new flux.transition_grid(fluxslider, $.extend({
- requires3d: true,
- forceSquare: true,
- columns: 5,
- perspective: 600,
- delayBetweenBarsX: 200,
- delayBetweenBarsY: 150,
- renderTile: function(elem, colIndex, rowIndex, colWidth, rowHeight, leftOffset, topOffset) {
- var tile = $('<div></div>').css({
- width: colWidth+'px',
- height: rowHeight+'px',
- position: 'absolute',
- top: '0px',
- left: '0px',
- //'z-index': 200, // Removed to make compatible with FF10 (Chrome bug seems to have been fixed)
- 'background-image': this.slider.image1.css('background-image'),
- 'background-position': '-'+leftOffset+'px -'+topOffset+'px',
- 'background-repeat': 'no-repeat',
- '-moz-transform': 'translateZ(1px)'
- }).css3({
- 'backface-visibility': 'hidden'
- });
- var tile2 = $(tile.get(0).cloneNode(false)).css({
- 'background-image': this.slider.image2.css('background-image')
- //'z-index': 190 // Removed to make compatible with FF10 (Chrome bug seems to have been fixed)
- }).css3({
- 'transform': flux.browser.rotateY(180),
- 'backface-visibility': 'hidden'
- });
- $(elem).css({
- 'z-index': (colIndex > this.options.columns/2 ? 500-colIndex : 500) + (rowIndex > this.options.rows/2 ? 500-rowIndex : 500) // Fix for Chrome to ensure that the z-index layering is correct!
- }).css3({
- 'transition-duration': '800ms',
- 'transition-timing-function': 'ease-out',
- 'transition-property': 'all',
- 'transition-delay': (colIndex*this.options.delayBetweenBarsX+rowIndex*this.options.delayBetweenBarsY)+'ms',
- 'transform-style': 'preserve-3d'
- }).append(tile).append(tile2);
- },
- execute: function() {
- this.slider.image1.css3({
- 'perspective': this.options.perspective,
- 'perspective-origin': '50% 50%'
- });
-
- var _this = this;
- var tiles = this.slider.image1.find('div.tile');
- this.slider.image2.hide();
- // Get notified when the last transition has completed
- tiles.last().transitionEnd(function(event){
- _this.slider.image2.show();
- _this.finished();
- });
-
- setTimeout(function(){
- tiles.css3({
- 'transform': flux.browser.rotateY(180)
- });
- }, 50);
- }
- }, opts));
- };
- })(window.jQuery || window.Zepto);
- (function($) {
- flux.transitions.turn = function(fluxslider, opts) {
- return new flux.transition(fluxslider, $.extend({
- requires3d: true,
- perspective: 1300,
- direction: 'left',
- setup: function() {
- var tab = $('<div class="tab"></div>').css({
- width: '50%',
- height: '100%',
- position: 'absolute',
- top: '0px',
- left: this.options.direction == 'left' ? '50%' : '0%',
- 'z-index':101
- }).css3({
- 'transform-style': 'preserve-3d',
- 'transition-duration': '1000ms',
- 'transition-timing-function': 'ease-out',
- 'transition-property': 'all',
- 'transform-origin': this.options.direction == 'left' ? 'left center' : 'right center'
- }),
- front = $('<div></div>').appendTo(tab).css({
- 'background-image': this.slider.image1.css('background-image'),
- 'background-position': (this.options.direction == 'left' ? '-'+(this.slider.image1.width()/2) : 0)+'px 0',
- width: '100%',
- height: '100%',
- position: 'absolute',
- top: '0',
- left: '0',
- '-moz-transform': 'translateZ(1px)'
- }).css3({
- 'backface-visibility': 'hidden'
- }),
- back = $('<div></div>').appendTo(tab).css({
- 'background-image': this.slider.image2.css('background-image'),
- 'background-position': (this.options.direction == 'left' ? 0 : '-'+(this.slider.image1.width()/2))+'px 0',
- width: '100%',
- height: '100%',
- position: 'absolute',
- top: '0',
- left: '0'
- }).css3({
- transform: flux.browser.rotateY(180),
- 'backface-visibility': 'hidden'
- }),
- current = $('<div></div>').css({
- position: 'absolute',
- top: '0',
- left: this.options.direction == 'left' ? '0' : '50%',
- width: '50%',
- height: '100%',
- 'background-image': this.slider.image1.css('background-image'),
- 'background-position': (this.options.direction == 'left' ? 0 : '-'+(this.slider.image1.width()/2))+'px 0',
- 'z-index':100
- }),
- overlay = $('<div class="overlay"></div>').css({
- position: 'absolute',
- top: '0',
- left: this.options.direction == 'left' ? '50%' : '0',
- width: '50%',
- height: '100%',
- background: '#000',
- opacity: 1
- }).css3({
- 'transition-duration': '800ms',
- 'transition-timing-function': 'linear',
- 'transition-property': 'opacity'
- }),
- container = $('<div></div>').css3({
- width: '100%',
- height: '100%'
- }).css3({
- 'perspective': this.options.perspective,
- 'perspective-origin': '50% 50%'
- }).append(tab).append(current).append(overlay);
- this.slider.image1.append(container);
- },
- execute: function() {
- var _this = this;
- this.slider.image1.find('div.tab').first().transitionEnd(function(){
- _this.finished();
- });
-
- setTimeout(function(){
- _this.slider.image1.find('div.tab').css3({
- // 179 not 180 so that the tab rotates the correct way in Firefox
- transform: flux.browser.rotateY(_this.options.direction == 'left' ? -179 : 179)
- });
- _this.slider.image1.find('div.overlay').css({
- opacity: 0
- });
- }, 50);
- }
- }, opts));
- };
- })(window.jQuery || window.Zepto);
- (function($) {
- flux.transitions.slide = function(fluxslider, opts) {
- return new flux.transition(fluxslider, $.extend({
- direction: 'left',
- setup: function() {
- var width = this.slider.image1.width(),
- height = this.slider.image1.height(),
- currentImage = $('<div class="current"></div>').css({
- height: height+'px',
- width: width+'px',
- position: 'absolute',
- top: '0px',
- left: '0px',
- background: this.slider[this.options.direction == 'left' ? 'image1' : 'image2'].css('background-image')
- }).css3({
- 'backface-visibility': 'hidden'
- }),
- nextImage = $('<div class="next"></div>').css({
- height: height+'px',
- width: width+'px',
- position: 'absolute',
- top: '0px',
- left: width+'px',
- background: this.slider[this.options.direction == 'left' ? 'image2' : 'image1'].css('background-image')
- }).css3({
- 'backface-visibility': 'hidden'
- });
- this.slideContainer = $('<div class="slide"></div>').css({
- width: (2*width)+'px',
- height: height+'px',
- position: 'relative',
- left: this.options.direction == 'left' ? '0px' : -width+'px',
- 'z-index': 101
- }).css3({
- 'transition-duration': '600ms',
- 'transition-timing-function': 'ease-in',
- 'transition-property': 'all'
- });
- this.slideContainer.append(currentImage).append(nextImage);
- this.slider.image1.append(this.slideContainer);
- },
- execute: function() {
- var _this = this,
- delta = this.slider.image1.width();
- if(this.options.direction == 'left')
- delta = -delta;
- this.slideContainer.transitionEnd(function(){
- _this.finished();
- });
-
- setTimeout(function(){
- _this.slideContainer.css3({
- 'transform' : flux.browser.translate(delta)
- });
- }, 50);
- }
- }, opts));
- };
- })(window.jQuery || window.Zepto);
- (function($) {
- flux.transitions.swipe = function(fluxslider, opts) {
- return new flux.transition(fluxslider, $.extend({
- setup: function() {
- var img = $('<div></div>').css({
- width: '100%',
- height: '100%',
- 'background-image': this.slider.image1.css('background-image')
- }).css3({
- 'transition-duration': '1600ms',
- 'transition-timing-function': 'ease-in',
- 'transition-property': 'all',
- 'mask-image': '-webkit-linear-gradient(left, rgba(0,0,0,0) 0%, rgba(0,0,0,0) 48%, rgba(0,0,0,1) 52%, rgba(0,0,0,1) 100%)',
- 'mask-position': '70%',
- 'mask-size': '400%'
- });
-
- this.slider.image1.append(img);
- },
- execute: function() {
- //return;
- var _this = this,
- img = this.slider.image1.find('div');
- // Get notified when the last transition has completed
- $(img).transitionEnd(function(){
- _this.finished();
- });
- setTimeout(function(){
- $(img).css3({
- 'mask-position': '30%'
- });
- }, 50);
- },
- compatibilityCheck: function() {
- return flux.browser.supportsCSSProperty('MaskImage');
- }
- }, opts));
- };
- })(window.jQuery || window.Zepto);
- (function($) {
- flux.transitions.dissolve = function(fluxslider, opts) {
- return new flux.transition(fluxslider, $.extend({
- setup: function() {
- var img = $('<div class="image"></div>').css({
- width: '100%',
- height: '100%',
- 'background-image': this.slider.image1.css('background-image')
- }).css3({
- 'transition-duration': '600ms',
- 'transition-timing-function': 'ease-in',
- 'transition-property': 'opacity'
- });
-
- this.slider.image1.append(img);
- },
- execute: function() {
- var _this = this,
- img = this.slider.image1.find('div.image');
- // Get notified when the last transition has completed
- $(img).transitionEnd(function(){
- _this.finished();
- });
- setTimeout(function(){
- $(img).css({
- 'opacity': '0.0'
- });
- }, 50);
- }
- }, opts));
- };
- })(window.jQuery || window.Zepto);
|