bbox: flex conditionally

This commit is contained in:
ed 2025-10-04 09:23:42 +00:00
parent dacc64dd2e
commit 171ca985c8
2 changed files with 8 additions and 12 deletions

View file

@ -231,7 +231,7 @@ window.baguetteBox = (function () {
btnNext = ebi('bbox-next'); btnNext = ebi('bbox-next');
btnHelp = ebi('bbox-help'); btnHelp = ebi('bbox-help');
btnAnim = ebi('bbox-anim'); btnAnim = ebi('bbox-anim');
btnReadDir = ebi('bbox-readdir') btnReadDir = ebi('bbox-readdir');
btnRotL = ebi('bbox-rotl'); btnRotL = ebi('bbox-rotl');
btnRotR = ebi('bbox-rotr'); btnRotR = ebi('bbox-rotr');
btnSel = ebi('bbox-tsel'); btnSel = ebi('bbox-tsel');
@ -357,13 +357,8 @@ window.baguetteBox = (function () {
} }
function toggleReadDir() { function toggleReadDir() {
var o = options; var o = options,
var next; next = options.readDirRtl ? "ltr" : "rtl";
if (options.readDirRtl) {
next = "ltr"
} else {
next = "rtl"
}
swrite('greaddir', next); swrite('greaddir', next);
slider.className = "no-transition"; slider.className = "no-transition";
options = {}; options = {};
@ -601,11 +596,13 @@ window.baguetteBox = (function () {
if (options.readDirRtl) { if (options.readDirRtl) {
btnReadDir.innerText = "rtl"; btnReadDir.innerText = "rtl";
msg = "browse from right to left"; msg = "browse from right to left";
slider.style.display = "flex";
slider.style.flexDirection = "row-reverse"; slider.style.flexDirection = "row-reverse";
} else { } else {
btnReadDir.innerText = "ltr"; btnReadDir.innerText = "ltr";
msg = "browse from left to right"; msg = "browse from left to right";
slider.style.flexDirection = "row"; slider.style.flexDirection = "";
slider.style.display = "block";
} }
btnReadDir.setAttribute("tt", msg); btnReadDir.setAttribute("tt", msg);
btnReadDir.setAttribute("aria-label", msg); btnReadDir.setAttribute("aria-label", msg);
@ -1119,8 +1116,8 @@ window.baguetteBox = (function () {
} }
function updateOffset(noTransition) { function updateOffset(noTransition) {
var dir = options.readDirRtl ? 1 : -1; var dir = options.readDirRtl ? 1 : -1,
var offset = dir * currentIndex * 100 + '%', offset = dir * currentIndex * 100 + '%',
xform = slider.style.perspective !== undefined; xform = slider.style.perspective !== undefined;
if (options.animation === 'fadeIn' && !noTransition) { if (options.animation === 'fadeIn' && !noTransition) {

View file

@ -2204,7 +2204,6 @@ html.y #bbox-overlay figcaption a {
margin-right: -1px; margin-right: -1px;
} }
#bbox-slider { #bbox-slider {
display: flex;
position: fixed; position: fixed;
left: 0; left: 0;
top: 0; top: 0;