accueil du forum - faq - recherche - [s'enregistrer]
HTML, etc...
Twisty Forum


Problèmes techniques :::::: défilements d'images



MessagesAuteurs
Bonsoir,

J'ai ce script qui m'affiche des vignettes et me permet de visionner des photos en automatique.

Est-ce que l'on peut adapter le script des défilements des images sur pour faires un défilements de mes miniatures.

Si oui comment faire ?

Merci de votre aide.

Salutations

*****
var nb_photos,numero_photo,photo_hauteur_max,photo_largeur_max;

photo_hauteur_max="360";
photo_largeur_max="540";

// numero de la photo courante
numero_photo=1;

// nombre de photos dans la galerie
nb_photos=1;

var liste_photos=new Array();
var auteurs=new Array();
var legendes=new Array();
var src_grandes_photos=new Array();

var nom_galerie='';

var diaporama_actif=0;
var duree=3000;

function js_charger_galerie(annee,sujet,galerie,n)
{
var i = 0;
var j = 1;
var nom_fichier="000";
var chemin = "/photos/" + annee + "/" + sujet + "/" + galerie + "/photos-dia/";
var chemin2 = "/photos/" + annee + "/" + sujet + "/" + galerie + "/photos/";

//var chemin = "/photos/" + annee + "/" + sujet + "/" + galerie + "/~~P*hotos-dia/";
//var chemin2 = "/photos/" + annee + "/" + sujet + "/" + galerie + "/~~P*hotos/";


nb_photos = n;

while (i<nb_photos)
{
liste_photos[i] = new Image();
liste_photos[i].src = chemin + nom_fichier.substr(0,nom_fichier.length-j.toString(10).length) + j + ".jpg";
//liste_photos[i].alt = "xxxxxxx : "+ nom_galerie + " - Photo : " + j + "/" + nb_photos;
liste_photos[i].alt = ""+ nom_galerie + " - " + j + "/" + nb_photos;
//liste_photos[i].title = "xxxxxxx : "+ nom_galerie + " - Photo : " + j + "/" + nb_photos;
liste_photos[i].title = ""+ nom_galerie + " - " + j + "/" + nb_photos;
src_grandes_photos[i] = chemin2 + nom_fichier.substr(0,nom_fichier.length-j.toString(10).length) + j + ".jpg";

i++;
j++;
//alert('i');
}
}

function js_premiere_photo()
{
numero_photo=1;
js_affiche_photo(numero_photo);
}

function js_en_avant()
{
(numero_photo == nb_photos) ? numero_photo=1 : numero_photo=numero_photo+1;
js_affiche_photo(numero_photo);
}

function js_en_arriere()
{
(numero_photo==1) ? numero_photo=nb_photos : numero_photo=(numero_photo-1);
js_affiche_photo(numero_photo);
}

function js_derniere_photo()
{
numero_photo=nb_photos;
js_affiche_photo(numero_photo);
}

function js_diaporama()
{
if (diaporama_actif == 0)
{
document.images['ico_diaporama'].src='../Outils/Icones/arret.gif';
document.images['ico_diaporama'].alt='Fin Diaporama';
document.images['ico_diaporama'].title='Arrêter le Diaporama';
diaporama_actif=1;
js_changer_photo();
}
else
{
document.images['ico_diaporama'].src='../Outils/Icones/lancer.gif';
document.images['ico_diaporama'].alt='Début Diaporama';
document.images['ico_diaporama'].title='Lancer le Diaporama';
diaporama_actif=0;
js_arret_diaporama();
}
}

function js_changer_photo()
{
(numero_photo == nb_photos) ? numero_photo=1 : numero_photo=numero_photo+1;
js_affiche_photo(numero_photo);
roll=setTimeout("js_changer_photo()",duree);
}

function js_arret_diaporama()
{
window.clearTimeout(roll);
document.getElementById('photo_agrandie').src=liste_photos[numero_photo-1].src;
}

function js_affiche_photo(k)
{
numero_photo=k;
image=document.getElementById('photo_agrandie');
image.alt=liste_photos[k-1].alt;
image.title=liste_photos[k-1].title;
image.src=liste_photos[k-1].src;

/~~ Inutile si les images de photos-dia sont correctement dimensionnées
if (liste_photos[k-1].width > photo_largeur_max || liste_photos[k-1].height > photo_hauteur_max)
{
if ((2~~liste_photos[k-1].width) > (3~~liste_photos[k-1].height))
{
image.width=540;
image.height=liste_photos[k-1].height/(liste_photos[k-1].width/540);
}
else
{
image.height=360;
image.width=liste_photos[k-1].width/(liste_photos[k-1].height/360);
}
}
else
{
image.width=liste_photos[k-1].width;
image.height=liste_photos[k-1].height;
}
~~/
document.getElementById('photo').getElementsByTagName("tr")[0].getElementsByTagName("th")[0].getElementsByTagName("h2")[0].firstChild.nodeValue=liste_photos[k-1].title;
//document.getElementById('photo').getElementsByTagName("tr")[2].getElementsByTagName("td")[0].firstChild.nodeValue=auteurs[k-1];
//document.getElementById('photo').getElementsByTagName("tr")[3].getElementsByTagName("td")[0].firstChild.nodeValue=legendes[k-1];
lien=document.getElementById('a_photo');
lien.href=src_grandes_photos[k-1];
lien=document.getElementById('photo_agrandie');
lien.src=liste_photos[k-1].src;
//lien.onclick="voirphoto('"+liste_photos[k-1].src+"');return false;";
//lien.onclick="retaille('"+liste_photos[k-1].src+"',1);return false;";
//alert (image.width + " "+ image.height);
}

/~~ Pour tester la configuration de l'internaute ~~/
function js_javascript_actif()
{
document.write("<p>Actuellement, sur votre navigateur, Javascript est activé.</p>");
}

/~~ Pour imprimer par un bouton du site ~~/

function js_imprimer()
{
if (window.print) {window.print();}
}

function js_proposer(bouton)
{
switch (bouton)
{
case "Imprimer":
document.write("<div class='imprimer_droite'><a href='#' title='Imprimer' onclick='javascript:js_imprimer(); return false;'><img src='/obj/images/ico_imprimer.gif' alt='Imprimer' title='Imprimer la partie centrale de la page'/></a></div>");
break;
case "Diaporama":
document.write("<div id='boutons_galerie'>");

document.write('<a href="#photo" title="Première" onclick="javascript:js_premiere_photo();"><img src="../Outils/Icones/premier.gif" alt="Première" title="Première photo de la galerie"/></a>');

document.write('<a href="#photo" title="Précédent" onclick="javascript:js_en_arriere();"><img src="../Outils/Icones/precedent.gif" alt="Précédente" title="Photo précédente"/></a>');

document.write('<a href="#photo" title="Diaporama" onclick="javascript:js_diaporama();"><img id="ico_diaporama" src="../Outils/Icones/lancer.gif" alt="Début Diaporama" title="Lancer le diaporama"/></a>');

document.write('<a href="#photo" title="Suivant" onclick="javascript:js_en_avant();"><img src="../Outils/Icones/suivante.gif" alt="Suivante" title="Photo suivante"/></a>');

document.write('<a href="#photo" title="Dernière" onclick="javascript:js_derniere_photo();"><img src="../Outils/Icones/derniere.gif" alt="Dernière" title="Dernière photo de la galerie"/></a>');

document.write('</div>');
break;
default:
alert("Erreur fonction Proposer(bouton) : paramètre non prévu.");
break;
}
}

function js_mot_majuscule(mot)
{
var m = mot.charAt(0).toUpperCase() + mot.substring(1).toLowerCase();
return m;
}


*****
Le 17-04-08 à 23h24
jmde
qui?
mail site


© Javatwist 2002 - JavaTwisting people