adjust lightbox size

This commit is contained in:
hugo LAMY
2026-02-15 18:18:56 +01:00
parent 91ec8b5a52
commit 9351009d31
4 changed files with 568 additions and 408 deletions

View File

@@ -37,11 +37,13 @@ Contacts dartistes à changer dans la mosaique
# page manifestations # page manifestations
- [ ] Pour la vidéo **insérer si possible en première image fixe** la vue extérieure du bâtiment - [x] Pour la vidéo **insérer si possible en première image fixe** la vue extérieure du bâtiment
- [ ] Si possible : absence de son par defaut - [x] Si possible : absence de son par defaut
- [ ] En reprenant la même charte graphique que dhabitude **placer les six photos dessous en vignettes pouvant souvrir d1 clique** (suivre lordre correspondant au numéro de chaque image, dans lidéal faire apparaitre le nom de lartiste) - [x] En reprenant la même charte graphique que dhabitude **placer les six photos dessous en vignettes pouvant souvrir d1 clique** (suivre lordre correspondant au numéro de chaque image, dans lidéal faire apparaitre le nom de lartiste)
- [x] ajuster taille des images
- [ ] Mettre le texte comme dhabitude (texte dans ce document) - [ ] Mettre le texte comme dhabitude (texte dans ce document)

View File

@@ -9,8 +9,7 @@
line-height: 0; line-height: 0;
} }
#lightbox img { #lightbox img {
width: auto; width: 100%;
height: auto;
} }
#lightbox a img { #lightbox a img {
border: none; border: none;
@@ -76,7 +75,10 @@
} }
#imageDataContainer { #imageDataContainer {
font: 11px Arial, Helvetica, sans-serif; font:
11px Arial,
Helvetica,
sans-serif;
background-color: #fff; background-color: #fff;
border-top: 1px #666666 solid; border-top: 1px #666666 solid;
margin: 0 auto; margin: 0 auto;
@@ -88,7 +90,11 @@
#imageData { #imageData {
padding: 0 10px; padding: 0 10px;
color: #666; color: #666;
font-family: Courrier New, Courrier, DejaVu Sans Mono, monospace; font-family:
Courrier New,
Courrier,
DejaVu Sans Mono,
monospace;
} }
#imageData #imageDetails { #imageData #imageDetails {
width: 70%; width: 70%;
@@ -101,7 +107,10 @@
font-weight: bold; font-weight: bold;
} }
#imageData #numberDisplay { #imageData #numberDisplay {
font: 10px Arial, Helvetica, sans-serif; font:
10px Arial,
Helvetica,
sans-serif;
display: block; display: block;
clear: left; clear: left;
padding-bottom: 1em; padding-bottom: 1em;

View File

@@ -45,9 +45,10 @@
// //
// Configurationl // Configurationl
// //
LightboxOptions = Object.extend({ LightboxOptions = Object.extend(
fileLoadingImage: 'images/loading.gif', {
fileBottomNavCloseImage: 'images/closelabel.gif', fileLoadingImage: "images/loading.gif",
fileBottomNavCloseImage: "images/closelabel.gif",
overlayOpacity: 0.8, // controls transparency of shadow overlay overlayOpacity: 0.8, // controls transparency of shadow overlay
@@ -59,8 +60,10 @@ LightboxOptions = Object.extend({
// When grouping images this is used to write: Image # of #. // When grouping images this is used to write: Image # of #.
// Change it for non-english localization // Change it for non-english localization
labelImage: "", labelImage: "",
labelOf: " /" labelOf: " /",
}, window.LightboxOptions || {}); },
window.LightboxOptions || {},
);
// ----------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------
@@ -75,8 +78,7 @@ Lightbox.prototype = {
// the function inserts html at the bottom of the page which is used to display the shadow // the function inserts html at the bottom of the page which is used to display the shadow
// overlay and the image container. // overlay and the image container.
// //
initialize: function() { initialize: function () {
this.updateImageList(); this.updateImageList();
this.keyboardAction = this.keyboardAction.bindAsEventListener(this); this.keyboardAction = this.keyboardAction.bindAsEventListener(this);
@@ -84,14 +86,15 @@ Lightbox.prototype = {
if (LightboxOptions.resizeSpeed > 10) LightboxOptions.resizeSpeed = 10; if (LightboxOptions.resizeSpeed > 10) LightboxOptions.resizeSpeed = 10;
if (LightboxOptions.resizeSpeed < 1) LightboxOptions.resizeSpeed = 1; if (LightboxOptions.resizeSpeed < 1) LightboxOptions.resizeSpeed = 1;
this.resizeDuration = LightboxOptions.animate ? ((11 - LightboxOptions.resizeSpeed) * 0.15) : 0; this.resizeDuration = LightboxOptions.animate
? (11 - LightboxOptions.resizeSpeed) * 0.15
: 0;
this.overlayDuration = LightboxOptions.animate ? 0.2 : 0; // shadow fade in/out duration this.overlayDuration = LightboxOptions.animate ? 0.2 : 0; // shadow fade in/out duration
// When Lightbox starts it will resize itself from 250 by 250 to the current image dimension. // When Lightbox starts it will resize itself from 250 by 250 to the current image dimension.
// If animations are turned off, it will be hidden as to prevent a flicker of a // If animations are turned off, it will be hidden as to prevent a flicker of a
// white 250 by 250 box. // white 250 by 250 box.
var size = (LightboxOptions.animate ? 250 : 1) + 'px'; var size = (LightboxOptions.animate ? 250 : 1) + "px";
// Code inserts html at the bottom of the page that looks similar to this: // Code inserts html at the bottom of the page that looks similar to this:
// //
@@ -126,56 +129,110 @@ Lightbox.prototype = {
// </div> // </div>
// </div> // </div>
var objBody = $$("body")[0];
var objBody = $$('body')[0]; objBody.appendChild(Builder.node("div", { id: "overlay" }));
objBody.appendChild(Builder.node('div',{id:'overlay'})); objBody.appendChild(
Builder.node("div", { id: "lightbox" }, [
objBody.appendChild(Builder.node('div',{id:'lightbox'}, [ Builder.node(
Builder.node('div',{id:'outerImageContainer'}, "div",
Builder.node('div',{id:'imageContainer'}, [ { id: "outerImageContainer" },
Builder.node('img',{id:'lightboxImage'}), Builder.node("div", { id: "imageContainer" }, [
Builder.node('div',{id:'hoverNav'}, [ Builder.node("img", { id: "lightboxImage" }),
Builder.node('a',{id:'prevLink', href: '#' }), Builder.node("div", { id: "hoverNav" }, [
Builder.node('a',{id:'nextLink', href: '#' }) Builder.node("a", { id: "prevLink", href: "#" }),
Builder.node("a", { id: "nextLink", href: "#" }),
]), ]),
Builder.node('div',{id:'loading'}, Builder.node(
Builder.node('a',{id:'loadingLink', href: '#' }, "div",
Builder.node('img', {src: LightboxOptions.fileLoadingImage}) { id: "loading" },
) Builder.node(
) "a",
]) { id: "loadingLink", href: "#" },
Builder.node("img", { src: LightboxOptions.fileLoadingImage }),
),
), ),
Builder.node('div', {id:'imageDataContainer'},
Builder.node('div',{id:'imageData'}, [
Builder.node('div',{id:'imageDetails'}, [
Builder.node('span',{id:'caption'}),
Builder.node('span',{id:'numberDisplay'})
]), ]),
Builder.node('div',{id:'bottomNav'}, ),
Builder.node('a',{id:'bottomNavClose', href: '#' }, Builder.node(
Builder.node('img', { src: LightboxOptions.fileBottomNavCloseImage }) "div",
) { id: "imageDataContainer" },
) Builder.node("div", { id: "imageData" }, [
]) Builder.node("div", { id: "imageDetails" }, [
) Builder.node("span", { id: "caption" }),
])); Builder.node("span", { id: "numberDisplay" }),
]),
Builder.node(
"div",
{ id: "bottomNav" },
Builder.node(
"a",
{ id: "bottomNavClose", href: "#" },
Builder.node("img", {
src: LightboxOptions.fileBottomNavCloseImage,
}),
),
),
]),
),
]),
);
$("overlay")
$('overlay').hide().observe('click', (function() { this.end(); }).bind(this)); .hide()
$('lightbox').hide().observe('click', (function(event) { if (event.element().id == 'lightbox') this.end(); }).bind(this)); .observe(
$('outerImageContainer').setStyle({ width: size, height: size }); "click",
$('prevLink').observe('click', (function(event) { event.stop(); this.changeImage(this.activeImage - 1); }).bindAsEventListener(this)); function () {
$('nextLink').observe('click', (function(event) { event.stop(); this.changeImage(this.activeImage + 1); }).bindAsEventListener(this)); this.end();
$('loadingLink').observe('click', (function(event) { event.stop(); this.end(); }).bind(this)); }.bind(this),
$('bottomNavClose').observe('click', (function(event) { event.stop(); this.end(); }).bind(this)); );
$("lightbox")
.hide()
.observe(
"click",
function (event) {
if (event.element().id == "lightbox") this.end();
}.bind(this),
);
$("outerImageContainer").setStyle({ width: size, height: size });
$("prevLink").observe(
"click",
function (event) {
event.stop();
this.changeImage(this.activeImage - 1);
}.bindAsEventListener(this),
);
$("nextLink").observe(
"click",
function (event) {
event.stop();
this.changeImage(this.activeImage + 1);
}.bindAsEventListener(this),
);
$("loadingLink").observe(
"click",
function (event) {
event.stop();
this.end();
}.bind(this),
);
$("bottomNavClose").observe(
"click",
function (event) {
event.stop();
this.end();
}.bind(this),
);
var th = this; var th = this;
(function(){ (function () {
var ids = var ids =
'overlay lightbox outerImageContainer imageContainer lightboxImage hoverNav prevLink nextLink loading loadingLink ' + "overlay lightbox outerImageContainer imageContainer lightboxImage hoverNav prevLink nextLink loading loadingLink " +
'imageDataContainer imageData imageDetails caption numberDisplay bottomNav bottomNavClose'; "imageDataContainer imageData imageDetails caption numberDisplay bottomNav bottomNavClose";
$w(ids).each(function(id){ th[id] = $(id); }); $w(ids).each(function (id) {
th[id] = $(id);
});
}).defer(); }).defer();
}, },
@@ -184,53 +241,73 @@ Lightbox.prototype = {
// Loops through anchor tags looking for 'lightbox' references and applies onclick // Loops through anchor tags looking for 'lightbox' references and applies onclick
// events to appropriate links. You can rerun after dynamically adding images w/ajax. // events to appropriate links. You can rerun after dynamically adding images w/ajax.
// //
updateImageList: function() { updateImageList: function () {
this.updateImageList = Prototype.emptyFunction; this.updateImageList = Prototype.emptyFunction;
document.observe('click', (function(event){ document.observe(
var target = event.findElement('a[rel^=lightbox]') || event.findElement('area[rel^=lightbox]'); "click",
function (event) {
var target =
event.findElement("a[rel^=lightbox]") ||
event.findElement("area[rel^=lightbox]");
if (target) { if (target) {
event.stop(); event.stop();
this.start(target); this.start(target);
} }
}).bind(this)); }.bind(this),
);
}, },
// //
// start() // start()
// Display overlay and lightbox. If image is part of a set, add siblings to imageArray. // Display overlay and lightbox. If image is part of a set, add siblings to imageArray.
// //
start: function(imageLink) { start: function (imageLink) {
$$("select", "object", "embed").each(function (node) {
$$('select', 'object', 'embed').each(function(node){ node.style.visibility = 'hidden' }); node.style.visibility = "hidden";
});
// stretch overlay to fill page and fade in // stretch overlay to fill page and fade in
var arrayPageSize = this.getPageSize(); var arrayPageSize = this.getPageSize();
$('overlay').setStyle({ width: arrayPageSize[0] + 'px', height: arrayPageSize[1] + 'px' }); $("overlay").setStyle({
width: arrayPageSize[0] + "px",
height: arrayPageSize[1] + "px",
});
new Effect.Appear(this.overlay, { duration: this.overlayDuration, from: 0.0, to: LightboxOptions.overlayOpacity }); new Effect.Appear(this.overlay, {
duration: this.overlayDuration,
from: 0.0,
to: LightboxOptions.overlayOpacity,
});
this.imageArray = []; this.imageArray = [];
var imageNum = 0; var imageNum = 0;
if ((imageLink.rel == 'lightbox')){ if (imageLink.rel == "lightbox") {
// if image is NOT part of a set, add single image to imageArray // if image is NOT part of a set, add single image to imageArray
this.imageArray.push([imageLink.href, imageLink.title]); this.imageArray.push([imageLink.href, imageLink.title]);
} else { } else {
// if image is part of a set.. // if image is part of a set..
this.imageArray = this.imageArray = $$(
$$(imageLink.tagName + '[href][rel="' + imageLink.rel + '"]'). imageLink.tagName + '[href][rel="' + imageLink.rel + '"]',
collect(function(anchor){ return [anchor.href, anchor.title]; }). )
uniq(); .collect(function (anchor) {
return [anchor.href, anchor.title];
})
.uniq();
while (this.imageArray[imageNum][0] != imageLink.href) { imageNum++; } while (this.imageArray[imageNum][0] != imageLink.href) {
imageNum++;
}
} }
// calculate top and left offset for the lightbox // calculate top and left offset for the lightbox
var arrayPageScroll = document.viewport.getScrollOffsets(); var arrayPageScroll = document.viewport.getScrollOffsets();
var lightboxTop = arrayPageScroll[1] + (document.viewport.getHeight() / 80); var lightboxTop = arrayPageScroll[1] + document.viewport.getHeight() / 80;
var lightboxLeft = arrayPageScroll[0]; var lightboxLeft = arrayPageScroll[0];
this.lightbox.setStyle({ top: lightboxTop + 'px', left: lightboxLeft + 'px' }).show(); this.lightbox
.setStyle({ top: lightboxTop + "px", left: lightboxLeft + "px" })
.show();
this.changeImage(imageNum); this.changeImage(imageNum);
}, },
@@ -239,8 +316,7 @@ Lightbox.prototype = {
// changeImage() // changeImage()
// Hide most elements and preload image in preparation for resizing image container. // Hide most elements and preload image in preparation for resizing image container.
// //
changeImage: function(imageNum) { changeImage: function (imageNum) {
this.activeImage = imageNum; // update global var this.activeImage = imageNum; // update global var
// hide elements during transition // hide elements during transition
@@ -250,33 +326,60 @@ Lightbox.prototype = {
this.prevLink.hide(); this.prevLink.hide();
this.nextLink.hide(); this.nextLink.hide();
// HACK: Opera9 does not currently support scriptaculous opacity and appear fx // HACK: Opera9 does not currently support scriptaculous opacity and appear fx
this.imageDataContainer.setStyle({opacity: .0001}); this.imageDataContainer.setStyle({ opacity: 0.0001 });
this.numberDisplay.hide(); this.numberDisplay.hide();
var imgPreloader = new Image(); var imgPreloader = new Image();
// once image is preloaded, resize image container // once image is preloaded, resize image container
imgPreloader.onload = function () {
imgPreloader.onload = (function(){
this.lightboxImage.src = this.imageArray[this.activeImage][0]; this.lightboxImage.src = this.imageArray[this.activeImage][0];
this.resizeImageContainer(imgPreloader.width, imgPreloader.height); this.resizeImageContainer(imgPreloader.width, imgPreloader.height);
}).bind(this); }.bind(this);
imgPreloader.src = this.imageArray[this.activeImage][0]; imgPreloader.src = this.imageArray[this.activeImage][0];
}, },
// //
// resizeImageContainer() // resizeImageContainer()
// //
resizeImageContainer: function(imgWidth, imgHeight) { resizeImageContainer: function (imgWidth, imgHeight) {
// get current width and height // get current width and height
var widthCurrent = this.outerImageContainer.getWidth(); var widthCurrent = this.outerImageContainer.getWidth();
var heightCurrent = this.outerImageContainer.getHeight(); var heightCurrent = this.outerImageContainer.getHeight();
// get viewport size
var arrayPageSize = this.getPageSize();
var windowWidth = arrayPageSize[2];
var windowHeight = arrayPageSize[3];
// Calculate the maximum allowable width and height for the image.
// This is the viewport size minus padding and the caption area height.
// The 'borderSize * 4' provides horizontal and vertical padding.
var maxImageWidth = windowWidth - LightboxOptions.borderSize * 4;
var maxImageHeight =
windowHeight -
LightboxOptions.borderSize * 4 -
this.imageDataContainer.getHeight();
// If the image is wider than the max allowable width,
// scale it down and adjust the height to maintain the aspect ratio.
if (imgWidth > maxImageWidth) {
imgHeight = imgHeight * (maxImageWidth / imgWidth);
imgWidth = maxImageWidth;
}
// If the image is taller than the max allowable height,
// scale it down and adjust the width to maintain the aspect ratio.
// This check is done after the width check to handle images that are both too wide and too tall.
if (imgHeight > maxImageHeight) {
imgWidth = imgWidth * (maxImageHeight / imgHeight);
imgHeight = maxImageHeight;
}
// get new width and height // get new width and height
var widthNew = (imgWidth + LightboxOptions.borderSize * 2); var widthNew = imgWidth + LightboxOptions.borderSize * 2;
var heightNew = (imgHeight + LightboxOptions.borderSize * 2); var heightNew = imgHeight + LightboxOptions.borderSize * 2;
// scalars based on change from old to new // scalars based on change from old to new
var xScale = (widthNew / widthCurrent) * 100; var xScale = (widthNew / widthCurrent) * 100;
@@ -286,36 +389,50 @@ Lightbox.prototype = {
var wDiff = widthCurrent - widthNew; var wDiff = widthCurrent - widthNew;
var hDiff = heightCurrent - heightNew; var hDiff = heightCurrent - heightNew;
if (hDiff != 0) new Effect.Scale(this.outerImageContainer, yScale, {scaleX: false, duration: this.resizeDuration, queue: 'front'}); if (hDiff != 0)
if (wDiff != 0) new Effect.Scale(this.outerImageContainer, xScale, {scaleY: false, duration: this.resizeDuration, delay: this.resizeDuration}); new Effect.Scale(this.outerImageContainer, yScale, {
scaleX: false,
duration: this.resizeDuration,
queue: "front",
});
if (wDiff != 0)
new Effect.Scale(this.outerImageContainer, xScale, {
scaleY: false,
duration: this.resizeDuration,
delay: this.resizeDuration,
});
// if new and old image are same size and no scaling transition is necessary, // if new and old image are same size and no scaling transition is necessary,
// do a quick pause to prevent image flicker. // do a quick pause to prevent image flicker.
var timeout = 0; var timeout = 0;
if ((hDiff == 0) && (wDiff == 0)){ if (hDiff == 0 && wDiff == 0) {
timeout = 100; timeout = 100;
if (Prototype.Browser.IE) timeout = 250; if (Prototype.Browser.IE) timeout = 250;
} }
(function(){ (function () {
this.prevLink.setStyle({ height: imgHeight + 'px' }); this.prevLink.setStyle({ height: imgHeight + "px" });
this.nextLink.setStyle({ height: imgHeight + 'px' }); this.nextLink.setStyle({ height: imgHeight + "px" });
this.imageDataContainer.setStyle({ width: widthNew + 'px' }); this.imageDataContainer.setStyle({ width: widthNew + "px" });
this.showImage(); this.showImage();
}).bind(this).delay(timeout / 1000); })
.bind(this)
.delay(timeout / 1000);
}, },
// //
// showImage() // showImage()
// Display image and begin preloading neighbors. // Display image and begin preloading neighbors.
// //
showImage: function(){ showImage: function () {
this.loading.hide(); this.loading.hide();
new Effect.Appear(this.lightboxImage, { new Effect.Appear(this.lightboxImage, {
duration: this.resizeDuration, duration: this.resizeDuration,
queue: 'end', queue: "end",
afterFinish: (function(){ this.updateDetails(); }).bind(this) afterFinish: function () {
this.updateDetails();
}.bind(this),
}); });
this.preloadNeighborImages(); this.preloadNeighborImages();
}, },
@@ -324,32 +441,49 @@ Lightbox.prototype = {
// updateDetails() // updateDetails()
// Display caption, image number, and bottom nav. // Display caption, image number, and bottom nav.
// //
updateDetails: function() { updateDetails: function () {
// if caption is not null // if caption is not null
if (this.imageArray[this.activeImage][1] != ""){ if (this.imageArray[this.activeImage][1] != "") {
this.caption.update(this.imageArray[this.activeImage][1]).show(); this.caption.update(this.imageArray[this.activeImage][1]).show();
} }
// if image is part of set display 'Image x of x' // if image is part of set display 'Image x of x'
if (this.imageArray.length > 1){ if (this.imageArray.length > 1) {
this.numberDisplay.update( LightboxOptions.labelImage + ' ' + (this.activeImage + 1) + ' ' + LightboxOptions.labelOf + ' ' + this.imageArray.length).show(); this.numberDisplay
.update(
LightboxOptions.labelImage +
" " +
(this.activeImage + 1) +
" " +
LightboxOptions.labelOf +
" " +
this.imageArray.length,
)
.show();
} }
new Effect.Parallel( new Effect.Parallel(
[ [
new Effect.SlideDown(this.imageDataContainer, { sync: true, duration: this.resizeDuration, from: 0.0, to: 1.0 }), new Effect.SlideDown(this.imageDataContainer, {
new Effect.Appear(this.imageDataContainer, { sync: true, duration: this.resizeDuration }) sync: true,
duration: this.resizeDuration,
from: 0.0,
to: 1.0,
}),
new Effect.Appear(this.imageDataContainer, {
sync: true,
duration: this.resizeDuration,
}),
], ],
{ {
duration: this.resizeDuration, duration: this.resizeDuration,
afterFinish: (function() { afterFinish: function () {
// update overlay size and update nav // update overlay size and update nav
var arrayPageSize = this.getPageSize(); var arrayPageSize = this.getPageSize();
this.overlay.setStyle({ height: arrayPageSize[1] + 'px' }); this.overlay.setStyle({ height: arrayPageSize[1] + "px" });
this.updateNav(); this.updateNav();
}).bind(this) }.bind(this),
} },
); );
}, },
@@ -357,15 +491,14 @@ Lightbox.prototype = {
// updateNav() // updateNav()
// Display appropriate previous and next hover navigation. // Display appropriate previous and next hover navigation.
// //
updateNav: function() { updateNav: function () {
this.hoverNav.show(); this.hoverNav.show();
// if not first image in set, display prev image button // if not first image in set, display prev image button
if (this.activeImage > 0) this.prevLink.show(); if (this.activeImage > 0) this.prevLink.show();
// if not last image in set, display next image button // if not last image in set, display next image button
if (this.activeImage < (this.imageArray.length - 1)) this.nextLink.show(); if (this.activeImage < this.imageArray.length - 1) this.nextLink.show();
this.enableKeyboardNav(); this.enableKeyboardNav();
}, },
@@ -373,41 +506,46 @@ Lightbox.prototype = {
// //
// enableKeyboardNav() // enableKeyboardNav()
// //
enableKeyboardNav: function() { enableKeyboardNav: function () {
document.observe('keydown', this.keyboardAction); document.observe("keydown", this.keyboardAction);
}, },
// //
// disableKeyboardNav() // disableKeyboardNav()
// //
disableKeyboardNav: function() { disableKeyboardNav: function () {
document.stopObserving('keydown', this.keyboardAction); document.stopObserving("keydown", this.keyboardAction);
}, },
// //
// keyboardAction() // keyboardAction()
// //
keyboardAction: function(event) { keyboardAction: function (event) {
var keycode = event.keyCode; var keycode = event.keyCode;
var escapeKey; var escapeKey;
if (event.DOM_VK_ESCAPE) { // mozilla if (event.DOM_VK_ESCAPE) {
// mozilla
escapeKey = event.DOM_VK_ESCAPE; escapeKey = event.DOM_VK_ESCAPE;
} else { // ie } else {
// ie
escapeKey = 27; escapeKey = 27;
} }
var key = String.fromCharCode(keycode).toLowerCase(); var key = String.fromCharCode(keycode).toLowerCase();
if (key.match(/x|o|c/) || (keycode == escapeKey)){ // close lightbox if (key.match(/x|o|c/) || keycode == escapeKey) {
// close lightbox
this.end(); this.end();
} else if ((key == 'p') || (keycode == 37)){ // display previous image } else if (key == "p" || keycode == 37) {
if (this.activeImage != 0){ // display previous image
if (this.activeImage != 0) {
this.disableKeyboardNav(); this.disableKeyboardNav();
this.changeImage(this.activeImage - 1); this.changeImage(this.activeImage - 1);
} }
} else if ((key == 'n') || (keycode == 39)){ // display next image } else if (key == "n" || keycode == 39) {
if (this.activeImage != (this.imageArray.length - 1)){ // display next image
if (this.activeImage != this.imageArray.length - 1) {
this.disableKeyboardNav(); this.disableKeyboardNav();
this.changeImage(this.activeImage + 1); this.changeImage(this.activeImage + 1);
} }
@@ -418,80 +556,90 @@ Lightbox.prototype = {
// preloadNeighborImages() // preloadNeighborImages()
// Preload previous and next images. // Preload previous and next images.
// //
preloadNeighborImages: function(){ preloadNeighborImages: function () {
var preloadNextImage, preloadPrevImage; var preloadNextImage, preloadPrevImage;
if (this.imageArray.length > this.activeImage + 1){ if (this.imageArray.length > this.activeImage + 1) {
preloadNextImage = new Image(); preloadNextImage = new Image();
preloadNextImage.src = this.imageArray[this.activeImage + 1][0]; preloadNextImage.src = this.imageArray[this.activeImage + 1][0];
} }
if (this.activeImage > 0){ if (this.activeImage > 0) {
preloadPrevImage = new Image(); preloadPrevImage = new Image();
preloadPrevImage.src = this.imageArray[this.activeImage - 1][0]; preloadPrevImage.src = this.imageArray[this.activeImage - 1][0];
} }
}, },
// //
// end() // end()
// //
end: function() { end: function () {
this.disableKeyboardNav(); this.disableKeyboardNav();
this.lightbox.hide(); this.lightbox.hide();
new Effect.Fade(this.overlay, { duration: this.overlayDuration }); new Effect.Fade(this.overlay, { duration: this.overlayDuration });
$$('select', 'object', 'embed').each(function(node){ node.style.visibility = 'visible' }); $$("select", "object", "embed").each(function (node) {
node.style.visibility = "visible";
});
}, },
// //
// getPageSize() // getPageSize()
// //
getPageSize: function() { getPageSize: function () {
var xScroll, yScroll; var xScroll, yScroll;
if (window.innerHeight && window.scrollMaxY) { if (window.innerHeight && window.scrollMaxY) {
xScroll = window.innerWidth + window.scrollMaxX; xScroll = window.innerWidth + window.scrollMaxX;
yScroll = window.innerHeight + window.scrollMaxY; yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac } else if (document.body.scrollHeight > document.body.offsetHeight) {
// all but Explorer Mac
xScroll = document.body.scrollWidth; xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight; yScroll = document.body.scrollHeight;
} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari } else {
// Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
xScroll = document.body.offsetWidth; xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight; yScroll = document.body.offsetHeight;
} }
var windowWidth, windowHeight; var windowWidth, windowHeight;
if (self.innerHeight) { // all except Explorer if (self.innerHeight) {
if(document.documentElement.clientWidth){ // all except Explorer
if (document.documentElement.clientWidth) {
windowWidth = document.documentElement.clientWidth; windowWidth = document.documentElement.clientWidth;
} else { } else {
windowWidth = self.innerWidth; windowWidth = self.innerWidth;
} }
windowHeight = self.innerHeight; windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode } else if (
document.documentElement &&
document.documentElement.clientHeight
) {
// Explorer 6 Strict Mode
windowWidth = document.documentElement.clientWidth; windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight; windowHeight = document.documentElement.clientHeight;
} else if (document.body) { // other Explorers } else if (document.body) {
// other Explorers
windowWidth = document.body.clientWidth; windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight; windowHeight = document.body.clientHeight;
} }
// for small pages with total height less then height of the viewport // for small pages with total height less then height of the viewport
if(yScroll < windowHeight){ if (yScroll < windowHeight) {
pageHeight = windowHeight; pageHeight = windowHeight;
} else { } else {
pageHeight = yScroll; pageHeight = yScroll;
} }
// for small pages with total width less then width of the viewport // for small pages with total width less then width of the viewport
if(xScroll < windowWidth){ if (xScroll < windowWidth) {
pageWidth = xScroll; pageWidth = xScroll;
} else { } else {
pageWidth = windowWidth; pageWidth = windowWidth;
} }
return [pageWidth,pageHeight]; return [pageWidth, pageHeight, windowWidth, windowHeight];
} },
} };
document.observe('dom:loaded', function () { new Lightbox(); }); document.observe("dom:loaded", function () {
new Lightbox();
});

View File

@@ -364,6 +364,7 @@
<video <video
width="480" width="480"
height="485" height="485"
muted
poster="images/manifestations/18_un-monde-en-soi/un-monde-en-soi_poster.jpg" poster="images/manifestations/18_un-monde-en-soi/un-monde-en-soi_poster.jpg"
controls controls
> >