diff --git a/dist/baguetteBox.min.css b/dist/baguetteBox.min.css index 203a755e..c1758c89 100644 --- a/dist/baguetteBox.min.css +++ b/dist/baguetteBox.min.css @@ -1 +1,6 @@ -#baguetteBoxOverlay{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}#baguetteBoxOverlay.visible{opacity:1}#baguetteBoxOverlay .fullImage{display:inline-block;width:100%;height:100%;text-align:center}#baguetteBoxOverlay .fullImage figure{display:inline;margin:0}#baguetteBoxOverlay .fullImage img{vertical-align:middle;max-height:100%;max-width:100%;-webkit-box-shadow:0 0 8px rgba(0,0,0,.6);box-shadow:0 0 8px rgba(0,0,0,.6)}#baguetteBoxOverlay .fullImage figcaption{position:absolute;bottom:0;width:100%;text-align:center;line-height:1.8;color:#ccc;background-color:rgba(0,0,0,.6);font-family:sans-serif}#baguetteBoxOverlay .fullImage:before{content:"";display:inline-block;height:50%;width:1px;margin-right:-1px}#baguetteBoxSlider{position:absolute;left:0;top:0;height:100%;width:100%;white-space:nowrap;-webkit-transition:left .4s ease;transition:left .4s ease}#baguetteBoxSlider.bounceFromRight{-webkit-animation:bounceFromRight .4s ease-out;animation:bounceFromRight .4s ease-out}#baguetteBoxSlider.bounceFromLeft{-webkit-animation:bounceFromLeft .4s ease-out;animation:bounceFromLeft .4s ease-out}.baguetteBoxButton{position:absolute;cursor:pointer;outline:0;padding:0;margin:0;border:0;border-radius:15%;background-color:rgba(68,68,68,.5);-webkit-transition:background-color .4s ease;transition:background-color .4s ease}.baguetteBoxButton:hover{background-color:rgba(68,68,68,.8)}.baguetteBoxButton#nextButton,.baguetteBoxButton#previousButton,.baguetteBoxButton.arrowButton{top:calc(50% - 30px);width:45px;height:60px}#nextButton{right:16px}#previousButton{left:16px}#closeButton{top:20px;right:24px}@-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}} \ No newline at end of file +/*! + * baguetteBox.js + * @author feimosi + * @version 0.4.0 + * @url https://github.com/feimosi/baguetteBox.js + */#baguetteBoxOverlay{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}#baguetteBoxOverlay.visible{opacity:1}#baguetteBoxOverlay .fullImage{display:inline-block;position:relative;width:100%;height:100%;text-align:center}#baguetteBoxOverlay .fullImage figure{display:inline;margin:0}#baguetteBoxOverlay .fullImage img{vertical-align:middle;max-height:100%;max-width:100%;-webkit-box-shadow:0 0 8px rgba(0,0,0,.6);box-shadow:0 0 8px rgba(0,0,0,.6)}#baguetteBoxOverlay .fullImage figcaption{position:absolute;bottom:0;width:100%;text-align:center;line-height:1.8;color:#ccc;background-color:rgba(0,0,0,.6);font-family:sans-serif}#baguetteBoxOverlay .fullImage:before{content:"";display:inline-block;height:50%;width:1px;margin-right:-1px}#baguetteBoxSlider{position:absolute;left:0;top:0;height:100%;width:100%;white-space:nowrap;-webkit-transition:left .4s ease;transition:left .4s ease}#baguetteBoxSlider.bounceFromRight{-webkit-animation:bounceFromRight .4s ease-out;animation:bounceFromRight .4s ease-out}#baguetteBoxSlider.bounceFromLeft{-webkit-animation:bounceFromLeft .4s ease-out;animation:bounceFromLeft .4s ease-out}.baguetteBoxButton{position:absolute;cursor:pointer;outline:0;padding:0;margin:0;border:0;border-radius:15%;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}.baguetteBoxButton:hover{background-color:rgba(50,50,50,.9)}.baguetteBoxButton#nextButton,.baguetteBoxButton#previousButton,.baguetteBoxButton.arrowButton{top:50%;top:calc(50% - 30px);width:44px;height:60px}#nextButton{right:2%}#previousButton{left:2%}#closeButton{top:20px;right:2%;right:calc(2% + 6px);width:30px;height:30px}#closeButton svg{position:absolute;top:0;left: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%;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);transform:scale(0)}50%{-webkit-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 53f06c0b..6619e7f6 100644 --- a/dist/baguetteBox.min.js +++ b/dist/baguetteBox.min.js @@ -1,6 +1,7 @@ /*! * baguetteBox.js * @author feimosi - * @version 0.3.0 + * @version 0.4.0 + * @url https://github.com/feimosi/baguetteBox.js */ -var baguetteBox=function(e,t){function n(){o(),[].forEach.call(L,function(e,t){e.dataset.baguetteBoxId=t,M[t]=e.getElementsByTagName("a"),[].forEach.call(M[t],function(e,n){e.addEventListener("click",function(e){e.preventDefault(),a(t),s(n)},!1)})})}function o(){return(w=document.getElementById(y))?(k=document.getElementById(E),C=document.getElementById("previousButton"),x=document.getElementById("nextButton"),void(N=document.getElementById("closeButton"))):(w=document.createElement("div"),w=document.getElementsByTagName("body")[0].appendChild(w),w.id=y,k=document.createElement("div"),k=w.appendChild(k),k.id=E,k.style.left="0%",b.buttons&&(C=document.createElement("button"),C.id="previousButton",C.innerHTML=p,C=w.appendChild(C),x=document.createElement("button"),x.id="nextButton",x.innerHTML=h,x=w.appendChild(x),N=document.createElement("button"),N.id="closeButton",N.innerHTML=v,N=w.appendChild(N),C.className=x.className=N.className="baguetteBoxButton"),void i())}function i(){w.addEventListener("click",function(e){e.target&&"IMG"!==e.target.nodeName&&c()},!1),b.buttons&&(document.getElementById("previousButton").addEventListener("click",function(e){e.stopPropagation(),u()},!1),document.getElementById("nextButton").addEventListener("click",function(e){e.stopPropagation(),r()},!1)),window.addEventListener("keydown",function(e){switch(e.keyCode){case 37:u();break;case 39:r();break;case 27:c()}},!1)}function a(e){if(I!==e){for(I=e;k.firstChild;)k.removeChild(k.firstChild);H.length=0;for(var t=0;t"+imageCaption+"":"";var o=document.createElement("figure"),i=document.createElement("img"),a=document.createElement("figcaption");n.appendChild(o),i.setAttribute("src",imageElement.getAttribute("href")),i.onload=function(){t()},o.appendChild(i),b.captions&&(a.innerHTML=imageCaption,o.appendChild(a))}}function r(){T<=H.length-2?(T++,m(),g(T)):(k.className="bounceFromRight",setTimeout(function(){k.className=""},400))}function u(){T>=1?(T--,m(),f(T)):(k.className="bounceFromLeft",setTimeout(function(){k.className=""},400))}function m(){k.style.left=100*-T+"%"}function g(e){Math.abs(T-e)>=b.preload||d(e+1,function(){g(e+1)})}function f(e){Math.abs(T-e)>=b.preload||d(e-1,function(){f(e-1)})}var p='',h='',v='',y="baguetteBoxOverlay",E="baguetteBoxSlider",b={captions:!0,preload:2,buttons:!0};for(var B in t)b.hasOwnProperty(B)&&(b[B]=t[B]);var w,k,C,x,N,T=0,I=-1,L=document.querySelectorAll(e),M={},H=[];n()}; \ No newline at end of file +var baguetteBox=function(e,t){function n(){o(),[].forEach.call(A,function(e,t){e.setAttribute("data-baguetteBoxId",t),H[t]=e.getElementsByTagName("a"),[].forEach.call(H[t],function(e,n){e.addEventListener("click",function(e){e.preventDefault(),a(t),d(n)})})})}function o(){return(w=document.getElementById(y))?(k=document.getElementById(E),C=document.getElementById("previousButton"),N=document.getElementById("nextButton"),void(x=document.getElementById("closeButton"))):(w=document.createElement("div"),w=document.getElementsByTagName("body")[0].appendChild(w),w.id=y,k=document.createElement("div"),k=w.appendChild(k),k.id=E,k.style.left="0%",b.buttons&&(C=document.createElement("button"),C.id="previousButton",C.innerHTML=f,C=w.appendChild(C),N=document.createElement("button"),N.id="nextButton",N.innerHTML=h,N=w.appendChild(N),x=document.createElement("button"),x.id="closeButton",x.innerHTML=v,x=w.appendChild(x),C.className=N.className=x.className="baguetteBoxButton"),void i())}function i(){w.addEventListener("click",function(e){e.target&&"IMG"!==e.target.nodeName&&l()}),b.buttons&&(document.getElementById("previousButton").addEventListener("click",function(e){e.stopPropagation(),r()}),document.getElementById("nextButton").addEventListener("click",function(e){e.stopPropagation(),u()}),document.getElementById("closeButton").addEventListener("click",function(e){e.stopPropagation(),l()})),w.addEventListener("touchstart",function(e){L=e.changedTouches[0].pageX}),w.addEventListener("touchmove",function(e){M||(e.preventDefault(),touch=e.touches[0]||e.changedTouches[0],touch.pageX-L>40?(M=!0,r()):touch.pageX-L<-40&&(M=!0,u()))}),w.addEventListener("touchend",function(){M=!1}),window.addEventListener("keydown",function(e){switch(e.keyCode){case 37:r();break;case 39:u();break;case 27:l()}})}function a(e){if(I!==e){for(I=e;k.firstChild;)k.removeChild(k.firstChild);P.length=0;for(var t=0;t
',o.appendChild(i),b.captions&&imageCaption&&(a.innerHTML=imageCaption,o.appendChild(a))}}function u(){T<=P.length-2?(T++,m(),g(T)):(k.className="bounceFromRight",setTimeout(function(){k.className=""},400))}function r(){T>=1?(T--,m(),p(T)):(k.className="bounceFromLeft",setTimeout(function(){k.className=""},400))}function m(){k.style.left=100*-T+"%"}function g(e){Math.abs(T-e)>=b.preload||s(e+1,function(){g(e+1)})}function p(e){Math.abs(T-e)>=b.preload||s(e-1,function(){p(e-1)})}var f='<',h='>',v='',y="baguetteBoxOverlay",E="baguetteBoxSlider",b={captions:!0,buttons:!0,preload:2};for(var B in t)b.hasOwnProperty(B)&&(b[B]=t[B]);var w,k,C,N,x,L,T=0,I=-1,M=!1,A=document.querySelectorAll(e),H={},P=[];n()}; \ No newline at end of file diff --git a/package.json b/package.json index 80e13fb3..65da580e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "baguetteBox.js", - "version": "0.3.0", + "version": "0.4.0", "description": "Simple and easy to use lightbox script", "main": "gulpfile.js", "devDependencies": {