1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
| var Chemin;
function Precedent(tabPhotos) {
var n = tabPhotos.length;
var index;
alert(Chemin);
for (var i = 0; i < n; i++) {
if(tabPhotos[i]==Chemin) {
index = i;
}
}
alert(index);
//parcourir tableau OK le tableau est sou le format [['chemin'],['chemin'],['chemin'],['chemin']]
//chercher le chemin
//recuperer son id : index est toujours indefined
//si je clique sur precedent j affiche image dont l index est id-1 sauf si debut [
var image = index;
new_image = images[image - 1]
if (new_image != '[') {
document.getElementById('imgFull').src = new_image;
image = image - 1;
}
}
function LoadDiv(url) {
var img = new Image();
var bcgDiv = document.getElementById("divBackground");
var imgDiv = document.getElementById("divImage");
var imgFull = document.getElementById("imgFull");
var imgLoader = document.getElementById("imgLoader");
imgLoader.style.display = "block";
img.onload = function () {
imgFull.src = img.src;
imgFull.style.display = "block";
imgLoader.style.display = "none";
};
img.src = url;
Chemin = url;
var width = document.body.clientWidth;
if (document.body.clientHeight > document.body.scrollHeight) {
bcgDiv.style.height = document.body.clientHeight + "px";
}
else {
bcgDiv.style.height = document.body.scrollHeight + "px";
}
imgDiv.style.left = (width - 650) / 2 + "px";
imgDiv.style.top = "20px";
bcgDiv.style.width = "100%";
bcgDiv.style.display = "block";
imgDiv.style.display = "block";
return false;
}
function HideDiv() {
var bcgDiv = document.getElementById("divBackground");
var imgDiv = document.getElementById("divImage");
var imgFull = document.getElementById("imgFull");
if (bcgDiv != null) {
bcgDiv.style.display = "none";
imgDiv.style.display = "none";
imgFull.style.display = "none";
}
} |
Partager