⬆️ upgrade baguetteBox.min.js to v1.13.0

This commit is contained in:
alex committed 2025-11-10 15:41:18 +07:00
1 parent 742c61aba2
commit 8a2b8c3532
2 files changed
+114 -73

No files matched your search

+112 -71
View File
@@ -1,10 +1,9 @@
/*! /*!
* baguetteBox.js * baguetteBox.js
* @author feimosi * @author feimosi
* @version %%INJECT_VERSION%% * @version 1.13.0
* @url https://github.com/feimosi/baguetteBox.js * @url https://github.com/feimosi/baguetteBox.js
*/ */
#baguetteBox-overlay { #baguetteBox-overlay {
display: none; display: none;
opacity: 0; opacity: 0;
@@ -16,39 +15,37 @@
height: 100%; height: 100%;
z-index: 1000000; z-index: 1000000;
background-color: #222; background-color: #222;
background-color: rgba(0,0,0,.8); background-color: rgba(0, 0, 0, 0.8);
transition: opacity .5s ease; -webkit-transition: opacity 0.5s ease;
transition: opacity 0.5s ease;
&.visible { }
#baguetteBox-overlay.visible {
opacity: 1; opacity: 1;
} }
#baguetteBox-overlay .full-image {
.full-image {
display: inline-block; display: inline-block;
position: relative; position: relative;
width: 100%; width: 100%;
height: 100%; height: 100%;
text-align: center; text-align: center;
}
figure { #baguetteBox-overlay .full-image figure {
display: inline; display: inline;
margin: 0; // needed for mobile margin: 0;
height: 100%; // Opera 12 image stretching fix height: 100%;
} }
#baguetteBox-overlay .full-image img {
img {
// IE8 fix
display: inline-block; display: inline-block;
width: auto; width: auto;
height: auto; height: auto;
max-height: 100%; max-height: 100%;
max-width: 100%; max-width: 100%;
vertical-align: middle; vertical-align: middle;
box-shadow: 0 0 8px rgba(0,0,0,.6); -webkit-box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
} -moz-box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
figcaption { }
#baguetteBox-overlay .full-image figcaption {
display: block; display: block;
position: absolute; position: absolute;
bottom: 0; bottom: 0;
@@ -58,18 +55,15 @@
white-space: normal; white-space: normal;
color: #ccc; color: #ccc;
background-color: #000; background-color: #000;
background-color: rgba(0,0,0,.6); background-color: rgba(0, 0, 0, 0.6);
font-family: sans-serif; font-family: sans-serif;
} }
#baguetteBox-overlay .full-image:before {
&:before {
content: ""; content: "";
display: inline-block; display: inline-block;
height: 50%; height: 50%;
width: 1px; width: 1px;
margin-right:-1px; margin-right: -1px;
}
}
} }
#baguetteBox-slider { #baguetteBox-slider {
@@ -79,30 +73,66 @@
height: 100%; height: 100%;
width: 100%; width: 100%;
white-space: nowrap; white-space: nowrap;
transition: left .4s ease, transform .4s ease; -webkit-transition: left 0.4s ease, -webkit-transform 0.4s ease;
transition: left 0.4s ease, -webkit-transform 0.4s ease;
transition: left 0.4s ease, transform 0.4s ease;
transition: left 0.4s ease, transform 0.4s ease, -webkit-transform 0.4s ease, -moz-transform 0.4s ease;
}
#baguetteBox-slider.bounce-from-right {
-webkit-animation: bounceFromRight 0.4s ease-out;
animation: bounceFromRight 0.4s ease-out;
}
#baguetteBox-slider.bounce-from-left {
-webkit-animation: bounceFromLeft 0.4s ease-out;
animation: bounceFromLeft 0.4s ease-out;
}
&.bounce-from-right { @-webkit-keyframes bounceFromRight {
animation: bounceFromRight .4s ease-out; 0% {
margin-left: 0;
} }
50% {
&.bounce-from-left { margin-left: -30px;
animation: bounceFromLeft .4s ease-out; }
100% {
margin-left: 0;
} }
} }
@keyframes bounceFromRight{ @keyframes bounceFromRight {
0% { margin-left: 0; } 0% {
50% { margin-left: -30px; } margin-left: 0;
100% { margin-left: 0; } }
50% {
margin-left: -30px;
}
100% {
margin-left: 0;
}
} }
@-webkit-keyframes bounceFromLeft {
@keyframes bounceFromLeft{ 0% {
0% { margin-left: 0; } margin-left: 0;
50% { margin-left: 30px; } }
100% { margin-left: 0; } 50% {
margin-left: 30px;
}
100% {
margin-left: 0;
}
} }
@keyframes bounceFromLeft {
%arrow-button { 0% {
margin-left: 0;
}
50% {
margin-left: 30px;
}
100% {
margin-left: 0;
}
}
.baguetteBox-button#previous-button, .baguetteBox-button#next-button {
top: 50%; top: 50%;
top: calc(50% - 30px); top: calc(50% - 30px);
width: 44px; width: 44px;
@@ -116,49 +146,41 @@
padding: 0; padding: 0;
margin: 0; margin: 0;
border: 0; border: 0;
-moz-border-radius: 15%;
border-radius: 15%; border-radius: 15%;
background-color: #323232; background-color: #323232;
background-color: rgba(50,50,50,.5); background-color: rgba(50, 50, 50, 0.5);
color: #ddd; color: #ddd;
font: 1.6em sans-serif; font: 1.6em sans-serif;
transition: background-color .4s ease; -webkit-transition: background-color 0.4s ease;
transition: background-color 0.4s ease;
&:focus, }
&:hover { .baguetteBox-button:focus, .baguetteBox-button:hover {
background-color: rgba(50,50,50,.9); background-color: rgba(50, 50, 50, 0.9);
} }
.baguetteBox-button#next-button {
&#next-button {
@extend %arrow-button;
right: 2%; right: 2%;
} }
.baguetteBox-button#previous-button {
&#previous-button {
@extend %arrow-button;
left: 2%; left: 2%;
} }
.baguetteBox-button#close-button {
&#close-button {
top: 20px; top: 20px;
right: 2%; right: 2%;
right: calc(2% + 6px); right: calc(2% + 6px);
width: 30px; width: 30px;
height: 30px; height: 30px;
} }
.baguetteBox-button svg {
// Firefox fix
svg {
position: absolute; position: absolute;
left: 0; left: 0;
top: 0; top: 0;
}
} }
/* /*
Preloader Preloader
Borrowed from http://tobiasahlin.com/spinkit/ Borrowed from http://tobiasahlin.com/spinkit/
*/ */
.baguetteBox-spinner { .baguetteBox-spinner {
width: 40px; width: 40px;
height: 40px; height: 40px;
@@ -174,23 +196,42 @@
.baguetteBox-double-bounce2 { .baguetteBox-double-bounce2 {
width: 100%; width: 100%;
height: 100%; height: 100%;
-moz-border-radius: 50%;
border-radius: 50%; border-radius: 50%;
background-color: #fff; background-color: #fff;
opacity: .6; opacity: 0.6;
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
-webkit-animation: bounce 2s infinite ease-in-out;
animation: bounce 2s infinite ease-in-out; animation: bounce 2s infinite ease-in-out;
} }
.baguetteBox-double-bounce2 { .baguetteBox-double-bounce2 {
-webkit-animation-delay: -1s;
animation-delay: -1s; animation-delay: -1s;
} }
@-webkit-keyframes bounce {
0%, 100% {
-webkit-transform: scale(0);
transform: scale(0);
}
50% {
-webkit-transform: scale(1);
transform: scale(1);
}
}
@keyframes bounce { @keyframes bounce {
0%, 100% { 0%, 100% {
-webkit-transform: scale(0);
-moz-transform: scale(0);
transform: scale(0); transform: scale(0);
} 50% { }
50% {
-webkit-transform: scale(1);
-moz-transform: scale(1);
transform: scale(1); transform: scale(1);
} }
} }
+2 -2
View File
@@ -1,7 +1,7 @@
/*! /*!
* baguetteBox.js * baguetteBox.js
* @author feimosi * @author feimosi
* @version 1.12.0 * @version 1.13.0
* @url https://github.com/feimosi/baguetteBox.js * @url https://github.com/feimosi/baguetteBox.js
*/ */
!function(e,t){"use strict";"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():e.baguetteBox=t()}(this,function(){"use strict";var s,l,u,c,d,f='<svg width="44" height="60"><polyline points="30 10 10 30 30 50" stroke="rgba(255,255,255,0.5)" stroke-width="4"stroke-linecap="butt" fill="none" stroke-linejoin="round"/></svg>',g='<svg width="44" height="60"><polyline points="14 10 34 30 14 50" stroke="rgba(255,255,255,0.5)" stroke-width="4"stroke-linecap="butt" fill="none" stroke-linejoin="round"/></svg>',p='<svg width="30" height="30"><g stroke="rgb(160,160,160)" stroke-width="4"><line x1="5" y1="5" x2="25" y2="25"/><line x1="5" y1="25" x2="25" y2="5"/></g></svg>',b={},v={captions:!0,buttons:"auto",fullScreen:!1,noScrollbars:!1,bodyClass:"baguetteBox-open",titleTag:!1,async:!1,preload:2,animation:"slideIn",afterShow:null,afterHide:null,onChange:null,overlayBackgroundColor:"rgba(0,0,0,.8)",closeX:p,leftArrow:f,rightArrow:g},m={},h=[],o=0,n=!1,i={},a=!1,y=/.+\.(gif|jpe?g|png|webp)/i,w={},k=[],r=null,x=function(e){-1!==e.target.id.indexOf("baguette-img")&&X()},E=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,q()},C=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,j()},B=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,X()},T=function(e){i.count++,1<i.count&&(i.multitouch=!0),i.startX=e.changedTouches[0].pageX,i.startY=e.changedTouches[0].pageY},A=function(e){if(!a&&!i.multitouch){e.preventDefault?e.preventDefault():e.returnValue=!1;var t=e.touches[0]||e.changedTouches[0];40<t.pageX-i.startX?(a=!0,q()):t.pageX-i.startX<-40?(a=!0,j()):100<i.startY-t.pageY&&X()}},L=function(){i.count--,i.count<=0&&(i.multitouch=!1),a=!1},N=function(){L()},H=function(e){"block"===s.style.display&&s.contains&&!s.contains(e.target)&&(e.stopPropagation(),M())};function P(e){if(w.hasOwnProperty(e)){var t=w[e].galleries;[].forEach.call(t,function(e){[].forEach.call(e,function(e){W(e.imageElement,"click",e.eventHandler)}),h===e&&(h=[])}),delete w[e]}}function S(e){switch(e.keyCode){case 37:q();break;case 39:j();break;case 27:X();break;case 36:!function t(e){e&&e.preventDefault();return D(0)}(e);break;case 35:!function n(e){e&&e.preventDefault();return D(h.length-1)}(e)}}function F(e,t){if(h!==e){for(h=e,function r(e){e=e||{};for(var t in v)b[t]=v[t],"undefined"!=typeof e[t]&&(b[t]=e[t]);l.style.transition=l.style.webkitTransition="fadeIn"===b.animation?"opacity .4s ease":"slideIn"===b.animation?"":"none","auto"===b.buttons&&("ontouchstart"in window||1===h.length)&&(b.buttons=!1);u.style.display=c.style.display=b.buttons?"":"none",d.innerHTML=b.closeX,b.buttons&&(u.innerHTML=b.leftArrow,c.innerHTML=b.rightArrow);try{s.style.backgroundColor=b.overlayBackgroundColor}catch(n){}}(t);l.firstChild;)l.removeChild(l.firstChild);for(var n,o=[],i=[],a=k.length=0;a<e.length;a++)(n=J("div")).className="full-image",n.id="baguette-img-"+a,k.push(n),o.push("baguetteBox-figure-"+a),i.push("baguetteBox-figcaption-"+a),l.appendChild(k[a]);s.setAttribute("aria-labelledby",o.join(" ")),s.setAttribute("aria-describedby",i.join(" "))}}function I(e){b.noScrollbars&&(document.documentElement.style.overflowY="hidden",document.body.style.overflowY="scroll"),"block"!==s.style.display&&(U(document,"keydown",S),i={count:0,startX:null,startY:null},Y(o=e,function(){z(o),V(o)}),R(),s.style.display="block",b.fullScreen&&function t(){s.requestFullscreen?s.requestFullscreen():s.webkitRequestFullscreen?s.webkitRequestFullscreen():s.mozRequestFullScreen&&s.mozRequestFullScreen()}(),setTimeout(function(){s.className="visible",b.bodyClass&&document.body.classList&&document.body.classList.add(b.bodyClass),b.afterShow&&b.afterShow()},50),b.onChange&&b.onChange(o,k.length),r=document.activeElement,M(),n=!0)}function M(){b.buttons?u.focus():d.focus()}function X(){b.noScrollbars&&(document.documentElement.style.overflowY="auto",document.body.style.overflowY="auto"),"none"!==s.style.display&&(W(document,"keydown",S),s.className="",setTimeout(function(){s.style.display="none",document.fullscreen&&function e(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}(),b.bodyClass&&document.body.classList&&document.body.classList.remove(b.bodyClass),b.afterHide&&b.afterHide(),r&&r.focus(),n=!1},500))}function Y(t,n){var e=k[t],o=h[t];if(void 0!==e&&void 0!==o)if(e.getElementsByTagName("img")[0])n&&n();else{var i=o.imageElement,a=i.getElementsByTagName("img")[0],r="function"==typeof b.captions?b.captions.call(h,i):i.getAttribute("data-caption")||i.title,s=function d(e){var t=e.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]);for(var i=Object.keys(n).sort(function(e,t){return parseInt(e,10)<parseInt(t,10)?-1:1}),a=window.innerWidth*window.devicePixelRatio,r=0;r<i.length-1&&i[r]<a;)r++;t=n[iLine truncated !function(e,t){"use strict";"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():e.baguetteBox=t()}(this,function(){"use strict";var s,l,u,c,d,f='<svg width="44" height="60"><polyline points="30 10 10 30 30 50" stroke="rgba(255,255,255,0.5)" stroke-width="4"stroke-linecap="butt" fill="none" stroke-linejoin="round"/></svg>',g='<svg width="44" height="60"><polyline points="14 10 34 30 14 50" stroke="rgba(255,255,255,0.5)" stroke-width="4"stroke-linecap="butt" fill="none" stroke-linejoin="round"/></svg>',p='<svg width="30" height="30"><g stroke="rgb(160,160,160)" stroke-width="4"><line x1="5" y1="5" x2="25" y2="25"/><line x1="5" y1="25" x2="25" y2="5"/></g></svg>',b={},m={captions:!0,buttons:"auto",fullScreen:!1,noScrollbars:!1,bodyClass:"baguetteBox-open",titleTag:!1,async:!1,preload:2,animation:"slideIn",afterShow:null,afterHide:null,onChange:null,overlayBackgroundColor:"rgba(0,0,0,.8)",closeX:p,leftArrow:f,rightArrow:g},v={},h=[],o=0,n=!1,i={},a=!1,y=/.+\.(gif|jpe?g|png|webp|avif)/i,w={},k=[],r=null,x=function(e){-1!==e.target.id.indexOf("baguette-img")&&M()},E=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,j()},C=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,Y()},B=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,M()},T=function(e){i.count++,1<i.count&&(i.multitouch=!0),i.startX=e.changedTouches[0].pageX,i.startY=e.changedTouches[0].pageY},A=function(e){if(!a&&!i.multitouch){e.preventDefault?e.preventDefault():e.returnValue=!1;var t=e.touches[0]||e.changedTouches[0];40<t.pageX-i.startX?(a=!0,j()):t.pageX-i.startX<-40?(a=!0,Y()):100<i.startY-t.pageY&&M()}},L=function(){i.count--,i.count<=0&&(i.multitouch=!1),a=!1},N=function(){L()},S=function(e){"block"===s.style.display&&s.contains&&!s.contains(e.target)&&(e.stopPropagation(),I())};function H(e){if(w.hasOwnProperty(e)){var t=w[e].galleries;[].forEach.call(t,function(e){[].forEach.call(e,function(e){W(e.imageElement,"click",e.eventHandler)}),h===e&&(h=[])}),delete w[e]}}function P(e){switch(e.keyCode){case 37:j();break;case 39:Y();break;case 27:M();break;case 36:!function t(e){e&&e.preventDefault();return D(0)}(e);break;case 35:!function n(e){e&&e.preventDefault();return D(h.length-1)}(e)}}function F(e,t){if(h!==e){for(h=e,function r(e){e=e||{};for(var t in m)b[t]=m[t],"undefined"!=typeof e[t]&&(b[t]=e[t]);l.style.transition=l.style.webkitTransition="fadeIn"===b.animation?"opacity .4s ease":"slideIn"===b.animation?"":"none","auto"===b.buttons&&("ontouchstart"in window||1===h.length)&&(b.buttons=!1);u.style.display=c.style.display=b.buttons?"":"none",d.innerHTML=b.closeX,b.buttons&&(u.innerHTML=b.leftArrow,c.innerHTML=b.rightArrow);try{s.style.backgroundColor=b.overlayBackgroundColor}catch(n){}}(t);l.firstChild;)l.removeChild(l.firstChild);for(var n,o=[],i=[],a=k.length=0;a<e.length;a++)(n=J("div")).className="full-image",n.id="baguette-img-"+a,k.push(n),o.push("baguetteBox-figure-"+a),i.push("baguetteBox-figcaption-"+a),l.appendChild(k[a]);s.setAttribute("aria-labelledby",o.join(" ")),s.setAttribute("aria-describedby",i.join(" "))}}function q(e){b.noScrollbars&&(document.documentElement.style.overflowY="hidden",document.body.style.overflowY="scroll"),"block"!==s.style.display&&(U(document,"keydown",P),i={count:0,startX:null,startY:null},X(o=e,function(){z(o),V(o)}),R(),s.style.display="block",b.fullScreen&&function t(){s.requestFullscreen?s.requestFullscreen():s.webkitRequestFullscreen?s.webkitRequestFullscreen():s.mozRequestFullScreen&&s.mozRequestFullScreen()}(),setTimeout(function(){s.className="visible",b.bodyClass&&document.body.classList&&document.body.classList.add(b.bodyClass),b.afterShow&&b.afterShow()},50),b.onChange&&b.onChange(o,k.length),r=document.activeElement,I(),n=!0)}function I(){b.buttons?u.focus():d.focus()}function M(){b.noScrollbars&&(document.documentElement.style.overflowY="auto",document.body.style.overflowY="auto"),"none"!==s.style.display&&(W(document,"keydown",P),s.className="",setTimeout(function(){s.style.display="none",document.fullscreen&&function e(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}(),b.bodyClass&&document.body.classList&&document.body.classList.remove(b.bodyClass),b.afterHide&&b.afterHide(),r&&r.focus(),n=!1},500))}function X(t,n){var e=k[t],o=h[t];if(void 0!==e&&void 0!==o)if(e.getElementsByTagName("img")[0])n&&n();else{var i=o.imageElement,a=i.getElementsByTagName("img")[0],r="function"==typeof b.captions?b.captions.call(h,i):i.getAttribute("data-caption")||i.title,s=function d(e){var t=e.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]);for(var i=Object.keys(n).sort(function(e,t){return parseInt(e,10)<parseInt(t,10)?-1:1}),a=window.innerWidth*window.devicePixelRatio,r=0;r<i.length-1&&i[r]<a;)r++;Line truncated