diff --git a/dist/baguetteBox.min.css b/dist/baguetteBox.min.css index 8d138240..4bf89e55 100644 --- a/dist/baguetteBox.min.css +++ b/dist/baguetteBox.min.css @@ -1,6 +1,6 @@ /*! * baguetteBox.js * @author feimosi - * @version 0.7.0 + * @version 1.0.0 * @url https://github.com/feimosi/baguetteBox.js - */#baguetteBox-overlay{display:none;opacity:0;position:fixed;overflow:hidden;top:0;left:0;width:100%;height:100%;z-index:1000000;background-color:#222;background-color:rgba(0,0,0,.8);-webkit-transition:opacity .5s ease;transition:opacity .5s ease}#baguetteBox-overlay.visible{opacity:1}#baguetteBox-overlay .full-image{display:inline-block;position:relative;width:100%;height:100%;text-align:center}#baguetteBox-overlay .full-image figure{display:inline;margin:0;height:100%}#baguetteBox-overlay .full-image img{display:inline-block;width:auto;height:auto;max-height:100%;max-width:100%;vertical-align:middle;-webkit-box-shadow:0 0 8px rgba(0,0,0,.6);-moz-box-shadow:0 0 8px rgba(0,0,0,.6);box-shadow:0 0 8px rgba(0,0,0,.6)}#baguetteBox-overlay .full-image figcaption{display:block;position:absolute;bottom:0;width:100%;text-align:center;line-height:1.8;color:#ccc;background-color:#000;background-color:rgba(0,0,0,.6);font-family:sans-serif}#baguetteBox-overlay .full-image:before{content:"";display:inline-block;height:50%;width:1px;margin-right:-1px}#baguetteBox-slider{position:absolute;left:0;top:0;height:100%;width:100%;white-space:nowrap;-webkit-transition:left .4s ease,-webkit-transform .4s ease;transition:left .4s ease,-moz-transform .4s ease;transition:left .4s ease,transform .4s ease}#baguetteBox-slider.bounce-from-right{-webkit-animation:bounceFromRight .4s ease-out;animation:bounceFromRight .4s ease-out}#baguetteBox-slider.bounce-from-left{-webkit-animation:bounceFromLeft .4s ease-out;animation:bounceFromLeft .4s ease-out}.baguetteBox-button#next-button,.baguetteBox-button#previous-button{top:50%;top:calc(50% - 30px);width:44px;height:60px}.baguetteBox-button{position:absolute;cursor:pointer;outline:0;padding:0;margin:0;border:0;-moz-border-radius:15%;border-radius:15%;background-color:#323232;background-color:rgba(50,50,50,.5);color:#ddd;font:1.6em sans-serif;-webkit-transition:background-color .4s ease;transition:background-color .4s ease}.baguetteBox-button:hover{background-color:rgba(50,50,50,.9)}.baguetteBox-button#next-button{right:2%}.baguetteBox-button#previous-button{left:2%}.baguetteBox-button#close-button{top:20px;right:2%;right:calc(2% + 6px);width:30px;height:30px}.spinner{width:40px;height:40px;display:inline-block;position:absolute;top:50%;left:50%;margin-top:-20px;margin-left:-20px}.double-bounce1,.double-bounce2{width:100%;height:100%;-moz-border-radius:50%;border-radius:50%;background-color:#fff;opacity:.6;position:absolute;top:0;left:0;-webkit-animation:bounce 2s infinite ease-in-out;animation:bounce 2s infinite ease-in-out}.double-bounce2{-webkit-animation-delay:-1s;animation-delay:-1s}@-webkit-keyframes bounceFromRight{0%{margin-left:0}50%{margin-left:-30px}100%{margin-left:0}}@keyframes bounceFromRight{0%{margin-left:0}50%{margin-left:-30px}100%{margin-left:0}}@-webkit-keyframes bounceFromLeft{0%{margin-left:0}50%{margin-left:30px}100%{margin-left:0}}@keyframes bounceFromLeft{0%{margin-left:0}50%{margin-left:30px}100%{margin-left:0}}@-webkit-keyframes bounce{0%,100%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes bounce{0%,100%{-webkit-transform:scale(0);-moz-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1);-moz-transform:scale(1);transform:scale(1)}} \ No newline at end of file + */#baguetteBox-overlay{display:none;opacity:0;position:fixed;overflow:hidden;top:0;left:0;width:100%;height:100%;z-index:1000000;background-color:#222;background-color:rgba(0,0,0,.8);-webkit-transition:opacity .5s ease;transition:opacity .5s ease}#baguetteBox-overlay.visible{opacity:1}#baguetteBox-overlay .full-image{display:inline-block;position:relative;width:100%;height:100%;text-align:center}#baguetteBox-overlay .full-image figure{display:inline;margin:0;height:100%}#baguetteBox-overlay .full-image img{display:inline-block;width:auto;height:auto;max-height:100%;max-width:100%;vertical-align:middle;-webkit-box-shadow:0 0 8px rgba(0,0,0,.6);-moz-box-shadow:0 0 8px rgba(0,0,0,.6);box-shadow:0 0 8px rgba(0,0,0,.6)}#baguetteBox-overlay .full-image figcaption{display:block;position:absolute;bottom:0;width:100%;text-align:center;line-height:1.8;color:#ccc;background-color:#000;background-color:rgba(0,0,0,.6);font-family:sans-serif}#baguetteBox-overlay .full-image:before{content:"";display:inline-block;height:50%;width:1px;margin-right:-1px}#baguetteBox-slider{position:absolute;left:0;top:0;height:100%;width:100%;white-space:nowrap;-webkit-transition:left .4s ease,-webkit-transform .4s ease;transition:left .4s ease,-moz-transform .4s ease;transition:left .4s ease,transform .4s ease}#baguetteBox-slider.bounce-from-right{-webkit-animation:bounceFromRight .4s ease-out;animation:bounceFromRight .4s ease-out}#baguetteBox-slider.bounce-from-left{-webkit-animation:bounceFromLeft .4s ease-out;animation:bounceFromLeft .4s ease-out}.baguetteBox-button#next-button,.baguetteBox-button#previous-button{top:50%;top:calc(50% - 30px);width:44px;height:60px}.baguetteBox-button{position:absolute;cursor:pointer;outline:0;padding:0;margin:0;border:0;-moz-border-radius:15%;border-radius:15%;background-color:#323232;background-color:rgba(50,50,50,.5);color:#ddd;font:1.6em sans-serif;-webkit-transition:background-color .4s ease;transition:background-color .4s ease}.baguetteBox-button:hover{background-color:rgba(50,50,50,.9)}.baguetteBox-button#next-button{right:2%}.baguetteBox-button#previous-button{left:2%}.baguetteBox-button#close-button{top:20px;right:2%;right:calc(2% + 6px);width:30px;height:30px}.baguetteBox-button svg{position:absolute;left:0;top:0}.spinner{width:40px;height:40px;display:inline-block;position:absolute;top:50%;left:50%;margin-top:-20px;margin-left:-20px}.double-bounce1,.double-bounce2{width:100%;height:100%;-moz-border-radius:50%;border-radius:50%;background-color:#fff;opacity:.6;position:absolute;top:0;left:0;-webkit-animation:bounce 2s infinite ease-in-out;animation:bounce 2s infinite ease-in-out}.double-bounce2{-webkit-animation-delay:-1s;animation-delay:-1s}@-webkit-keyframes bounceFromRight{0%{margin-left:0}50%{margin-left:-30px}100%{margin-left:0}}@keyframes bounceFromRight{0%{margin-left:0}50%{margin-left:-30px}100%{margin-left:0}}@-webkit-keyframes bounceFromLeft{0%{margin-left:0}50%{margin-left:30px}100%{margin-left:0}}@keyframes bounceFromLeft{0%{margin-left:0}50%{margin-left:30px}100%{margin-left:0}}@-webkit-keyframes bounce{0%,100%{-webkit-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes bounce{0%,100%{-webkit-transform:scale(0);-moz-transform:scale(0);transform:scale(0)}50%{-webkit-transform:scale(1);-moz-transform:scale(1);transform:scale(1)}} \ No newline at end of file diff --git a/dist/baguetteBox.min.js b/dist/baguetteBox.min.js index 0d4573cd..616d9a32 100644 --- a/dist/baguetteBox.min.js +++ b/dist/baguetteBox.min.js @@ -1,7 +1,7 @@ /*! * baguetteBox.js * @author feimosi - * @version 0.7.0 + * @version 1.0.0 * @url https://github.com/feimosi/baguetteBox.js */ -var baguetteBox=function(){function e(e,n){t(),H=document.querySelectorAll(e),[].forEach.call(H,function(e){var t=D.length;D.push(e.getElementsByTagName("a")),D[t].options=n,[].forEach.call(D[t],function(e,n){y(e,"click",function(e){e.preventDefault?e.preventDefault():e.returnValue=!1,o(t),s(n)})})}),P.transforms=p()}function t(){return(h=document.getElementById(C))?(v=document.getElementById(x),b=document.getElementById("previous-button"),E=document.getElementById("next-button"),void(k=document.getElementById("close-button"))):(h=document.createElement("div"),h.id=C,document.getElementsByTagName("body")[0].appendChild(h),v=document.createElement("div"),v.id=x,h.appendChild(v),b=document.createElement("button"),b.id="previous-button",b.innerHTML=B,h.appendChild(b),E=document.createElement("button"),E.id="next-button",E.innerHTML=N,h.appendChild(E),k=document.createElement("button"),k.id="close-button",k.innerHTML=T,h.appendChild(k),b.className=E.className=k.className="baguetteBox-button",void n())}function n(){y(h,"click",function(e){e.target&&"IMG"!==e.target.nodeName&&r()}),y(document.getElementById("previous-button"),"click",function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,d()}),y(document.getElementById("next-button"),"click",function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,u()}),y(document.getElementById("close-button"),"click",function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,r()}),y(h,"touchstart",function(e){w=e.changedTouches[0].pageX}),y(h,"touchmove",function(e){M||(e.preventDefault?e.preventDefault():e.returnValue=!1,touch=e.touches[0]||e.changedTouches[0],touch.pageX-w>40?(M=!0,d()):touch.pageX-w<-40&&(M=!0,u()))}),y(h,"touchend",function(){M=!1}),y(document,"keydown",function(e){switch(e.keyCode){case 37:d();break;case 39:u();break;case 27:r()}})}function o(e){if(A!==e){for(A=e,i(D[e].options);v.firstChild;)v.removeChild(v.firstChild);S.length=0;for(var t=0;t
',i.onload=function(){var e=this.parentNode.querySelector(".spinner");this.parentNode.removeChild(e),!I.async&&t&&t()},i.setAttribute("src",imageSrc),o.appendChild(i),I.captions&&imageCaption&&(a.innerHTML=imageCaption,o.appendChild(a)),I.async&&t&&t()}}function c(e){var t=imageElement.getAttribute("href");if(e.dataset){var n=[];for(var o in e.dataset)"at-"!==o.substring(0,3)||isNaN(o.substring(3))||(n[o.replace("at-","")]=e.dataset[o]);keys=Object.keys(n).sort(function(e,t){return parseInt(e)=i){t=n[keys[a]];break}t=n[keys[a]]}}return t}function u(){L<=S.length-2?(L++,m(),f(L)):(v.className="bounce-from-right",setTimeout(function(){v.className=""},400))}function d(){L>=1?(L--,m(),g(L)):(v.className="bounce-from-left",setTimeout(function(){v.className=""},400))}function m(){var e=100*-L+"%";"fadeIn"===I.animation?(v.style.opacity=0,setTimeout(function(){I.transforms?v.style.transform=v.style.webkitTransform="translate3d("+e+",0,0)":v.style.left=e,v.style.opacity=1},400)):I.transforms?v.style.transform=v.style.webkitTransform="translate3d("+e+",0,0)":v.style.left=e}function p(){var e=document.createElement("div"),t=!1;return t="undefined"!=typeof e.style.perspective||"undefined"!=typeof e.style.webkitPerspective}function f(e){e-L>=I.preload||l(e+1,function(){f(e+1)})}function g(e){L-e>=I.preload||l(e-1,function(){g(e-1)})}function y(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent("on"+t,n)}var h,v,b,E,k,w,B='<',N='>',T='X',C="baguetteBox-overlay",x="baguetteBox-slider",I={},P={captions:!0,buttons:"auto",async:!1,preload:2,animation:"slideIn"},L=0,A=-1,M=!1,H=[],D=[],S=[];return Array.prototype.forEach||(Array.prototype.forEach=function(e,t){for(var n=this.length,o=0;n>o;o++)e.call(t,this[o],o,this)}),{run:e}}(); \ No newline at end of file +var baguetteBox=function(){function t(t,n){P.transforms=f(),P.svg=p(),e(),D=document.querySelectorAll(t),[].forEach.call(D,function(t){var e=t.getElementsByTagName("a");e=[].filter.call(e,function(t){return j.test(t.href)});var o=S.length;S.push(e),S[o].options=n,[].forEach.call(S[o],function(t,e){h(t,"click",function(t){t.preventDefault?t.preventDefault():t.returnValue=!1,i(o),a(e)})})})}function e(){return(b=v("baguetteBox-overlay"))?(k=v("baguetteBox-slider"),w=v("previous-button"),C=v("next-button"),void(T=v("close-button"))):(b=y("div"),b.id="baguetteBox-overlay",document.getElementsByTagName("body")[0].appendChild(b),k=y("div"),k.id="baguetteBox-slider",b.appendChild(k),w=y("button"),w.id="previous-button",w.innerHTML=P.svg?N:"<",b.appendChild(w),C=y("button"),C.id="next-button",C.innerHTML=P.svg?x:">",b.appendChild(C),T=y("button"),T.id="close-button",T.innerHTML=P.svg?B:"X",b.appendChild(T),w.className=C.className=T.className="baguetteBox-button",void n())}function n(){h(b,"click",function(t){t.target&&"IMG"!==t.target.nodeName&&s()}),h(w,"click",function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0,c()}),h(C,"click",function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0,u()}),h(T,"click",function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0,s()}),h(b,"touchstart",function(t){E=t.changedTouches[0].pageX}),h(b,"touchmove",function(t){A||(t.preventDefault?t.preventDefault():t.returnValue=!1,touch=t.touches[0]||t.changedTouches[0],touch.pageX-E>40?(A=!0,c()):touch.pageX-E<-40&&(A=!0,u()))}),h(b,"touchend",function(){A=!1}),h(document,"keydown",function(t){switch(t.keyCode){case 37:c();break;case 39:u();break;case 27:s()}})}function i(t){if(H!==t){for(H=t,o(S[t].options);k.firstChild;)k.removeChild(k.firstChild);X.length=0;for(var e,n=0;n
',o.onload=function(){var n=document.querySelector("#baguette-img-"+t+" .spinner");i.removeChild(n),!I.async&&e&&e()},o.setAttribute("src",imageSrc),i.appendChild(o),I.captions&&imageCaption&&(a.innerHTML=imageCaption,i.appendChild(a)),I.async&&e&&e()}}function l(t){var e=imageElement.href;if(t.dataset){var n=[];for(var i in t.dataset)"at-"!==i.substring(0,3)||isNaN(i.substring(3))||(n[i.replace("at-","")]=t.dataset[i]);keys=Object.keys(n).sort(function(t,e){return parseInt(t)=1?(M--,d(),m(M)):(k.className="bounce-from-left",setTimeout(function(){k.className=""},400))}function d(){var t=100*-M+"%";"fadeIn"===I.animation?(k.style.opacity=0,setTimeout(function(){P.transforms?k.style.transform=k.style.webkitTransform="translate3d("+t+",0,0)":k.style.left=t,k.style.opacity=1},400)):P.transforms?k.style.transform=k.style.webkitTransform="translate3d("+t+",0,0)":k.style.left=t}function f(){var t=y("div");return"undefined"!=typeof t.style.perspective||"undefined"!=typeof t.style.webkitPerspective}function p(){var t=y("div");return t.innerHTML="","http://www.w3.org/2000/svg"==(t.firstChild&&t.firstChild.namespaceURI)}function g(t){t-M>=I.preload||r(t+1,function(){g(t+1)})}function m(t){M-t>=I.preload||r(t-1,function(){m(t-1)})}function h(t,e,n){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent("on"+e,n)}function v(t){return document.getElementById(t)}function y(t){return document.createElement(t)}var b,k,w,C,T,E,N='',x='',B='',I={},L={captions:!0,buttons:"auto",async:!1,preload:2,animation:"slideIn"},P={},M=0,H=-1,A=!1,j=/.+\.(gif|jpe?g|png|webp)$/i,D=[],S=[],X=[];return[].forEach||(Array.prototype.forEach=function(t,e){for(var n=0;n