diff --git a/js/flux.js b/js/flux.js index 39eb05b..eb6267c 100644 --- a/js/flux.js +++ b/js/flux.js @@ -488,8 +488,8 @@ window.flux = { }, supportsCSSProperty: function(prop) { var div = document.createElement('div'), - prefixes = ['-webkit', '-moz', '-o', '-ms'], - domPrefixes = ['Webkit', 'Moz', 'O', 'Ms']; + prefixes = ['', '-webkit', '-moz', '-o', '-ms'], + domPrefixes = ['', 'Webkit', 'Moz', 'O', 'Ms']; var support = false; for(var i=0; i' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + ''); var img = $('
').css({ width: '100%', height: '100%', @@ -1521,6 +1533,7 @@ window.flux = { }); this.slider.image1.append(img); + this.slider.image1.append(svgmask); }, execute: function() { //return; @@ -1530,16 +1543,25 @@ window.flux = { // Get notified when the last transition has completed $(img).transitionEnd(function(){ _this.finished(); - }); + }).get()[0].addEventListener('end', function() { + _this.finished(); + }, false); setTimeout(function(){ - $(img).css3({ - 'mask-position': '30%' - }); + if (flux.browser.supportsCSSProperty('MaskImage')) { + $(img).css3({ + 'mask-position': '30%' + }); + } else if (flux.browser.supportsCSSProperty('mask')) { + $(img).css3({ + 'mask': 'url(#myMask)' + }); + } }, 50); }, compatibilityCheck: function() { - return flux.browser.supportsCSSProperty('MaskImage'); + return flux.browser.supportsCSSProperty('MaskImage') || + flux.browser.supportsCSSProperty('mask'); } }, opts)); }; diff --git a/js/flux.min.js b/js/flux.min.js index 985699f..a3fdc7c 100644 --- a/js/flux.min.js +++ b/js/flux.min.js @@ -22,9 +22,9 @@ this.getImage(this.nextImageIndex).src+'")',"z-index":100}).show();if(this.optio {fallback:true})}a.run();this.currentImageIndex=this.nextImageIndex;this.setNextIndex(this.currentImageIndex+1);this.updateCaption()},updateCaption:function(){var c=b(this.getImage(this.currentImageIndex)).attr("title");if(this.options.captions&&this.captionBar){c!==""&&this.captionBar.html(c);this.captionBar.css("opacity",c===""?0:1)}},getImage:function(c){c%=this.images.length;return this.images[c]},setNextIndex:function(c){if(c==undefined)c=this.currentImageIndex+1;this.nextImageIndex=c;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); (function(b){flux.browser={init:function(){if(flux.browser.supportsTransitions===undefined){document.createElement("div");var c=["-webkit","-moz","-o","-ms"];flux.browser.supportsTransitions=window.Modernizr&&Modernizr.csstransitions!==undefined?Modernizr.csstransitions:this.supportsCSSProperty("Transition");if(window.Modernizr&&Modernizr.csstransforms3d!==undefined)flux.browser.supports3d=Modernizr.csstransforms3d;else{flux.browser.supports3d=this.supportsCSSProperty("Perspective");if(flux.browser.supports3d&& -"webkitPerspective"in b("body").get(0).style){var e=b('
');c=b('');b("body").append(e);b("head").append(c);flux.browser.supports3d=e.get(0).offsetLeft==9;e.remove();c.remove()}}}},supportsCSSProperty:function(c){for(var e=document.createElement("div"),a=["Webkit","Moz","O","Ms"],d=false,f=0;f');c=b('');b("body").append(e);b("head").append(c);flux.browser.supports3d=e.get(0).offsetLeft==9;e.remove();c.remove()}}}},supportsCSSProperty:function(c){for(var e=document.createElement("div"),a=["","Webkit","Moz","O","Ms"],d=false,f=0;f').css({height:d+"px",width:a+"px",position:"absolute",top:"0px",left:"0px",background:this.slider[this.options.direction=="left"?"image1":"image2"].css("background-image")}).css3({"backface-visibility":"hidden"}),g=b('').css({height:d+"px",width:a+"px",position:"absolute", top:"0px",left:a+"px",background:this.slider[this.options.direction=="left"?"image2":"image1"].css("background-image")}).css3({"backface-visibility":"hidden"});this.slideContainer=b('
').css({width:2*a+"px",height:d+"px",position:"relative",left:this.options.direction=="left"?"0px":-a+"px","z-index":101}).css3({"transition-duration":"600ms","transition-timing-function":"ease-in","transition-property":"all"});this.slideContainer.append(f).append(g);this.slider.image1.append(this.slideContainer)}, execute:function(){var a=this,d=this.slider.image1.width();if(this.options.direction=="left")d=-d;this.slideContainer.transitionEnd(function(){a.finished()});setTimeout(function(){a.slideContainer.css3({transform:flux.browser.translate(d)})},50)}},e))}})(window.jQuery||window.Zepto); -(function(b){flux.transitions.swipe=function(c,e){return new flux.transition(c,b.extend({setup:function(){this.slider.image1.append(b("
").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%"}))}, -execute:function(){var a=this,d=this.slider.image1.find("div");b(d).transitionEnd(function(){a.finished()});setTimeout(function(){b(d).css3({"mask-position":"30%"})},50)},compatibilityCheck:function(){return flux.browser.supportsCSSProperty("MaskImage")}},e))}})(window.jQuery||window.Zepto); +(function(b){flux.transitions.swipe=function(c,e){return new flux.transition(c,b.extend({setup:function(){var a=b('');this.slider.image1.append(b("
").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(a)},execute:function(){var a=this,d=this.slider.image1.find("div");b(d).transitionEnd(function(){a.finished()}).get()[0].addEventListener("end", +function(){a.finished()},false);setTimeout(function(){if(flux.browser.supportsCSSProperty("MaskImage"))b(d).css3({"mask-position":"30%"});else flux.browser.supportsCSSProperty("mask")&&b(d).css3({mask:"url(#myMask)"})},50)},compatibilityCheck:function(){return flux.browser.supportsCSSProperty("MaskImage")||flux.browser.supportsCSSProperty("mask")}},e))}})(window.jQuery||window.Zepto); (function(b){flux.transitions.dissolve=function(c,e){return new flux.transition(c,b.extend({setup:function(){this.slider.image1.append(b('
').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"}))},execute:function(){var a=this,d=this.slider.image1.find("div.image");b(d).transitionEnd(function(){a.finished()});setTimeout(function(){b(d).css({opacity:"0.0"})}, 50)}},e))}})(window.jQuery||window.Zepto); diff --git a/js/src/flux.browser.js b/js/src/flux.browser.js index baca68a..1edb1f3 100644 --- a/js/src/flux.browser.js +++ b/js/src/flux.browser.js @@ -48,8 +48,8 @@ }, supportsCSSProperty: function(prop) { var div = document.createElement('div'), - prefixes = ['-webkit', '-moz', '-o', '-ms'], - domPrefixes = ['Webkit', 'Moz', 'O', 'Ms']; + prefixes = ['', '-webkit', '-moz', '-o', '-ms'], + domPrefixes = ['', 'Webkit', 'Moz', 'O', 'Ms']; var support = false; for(var i=0; i' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + ''); var img = $('
').css({ width: '100%', height: '100%', @@ -16,6 +28,7 @@ }); this.slider.image1.append(img); + this.slider.image1.append(svgmask); }, execute: function() { //return; @@ -25,16 +38,25 @@ // Get notified when the last transition has completed $(img).transitionEnd(function(){ _this.finished(); - }); + }).get()[0].addEventListener('end', function() { + _this.finished(); + }, false); setTimeout(function(){ - $(img).css3({ - 'mask-position': '30%' - }); + if (flux.browser.supportsCSSProperty('MaskImage')) { + $(img).css3({ + 'mask-position': '30%' + }); + } else if (flux.browser.supportsCSSProperty('mask')) { + $(img).css3({ + 'mask': 'url(#myMask)' + }); + } }, 50); }, compatibilityCheck: function() { - return flux.browser.supportsCSSProperty('MaskImage'); + return flux.browser.supportsCSSProperty('MaskImage') || + flux.browser.supportsCSSProperty('mask'); } }, opts)); };