Je n'avais jamais m�me chercher � savoir comment fonctionne un script javascript auparavant, donc je d�bute vraiment, mais dans ce script, la condition, Si l'image est aggrandie ... je ne la trouve pas ...
J'aimerais int�grer un history.go(-1) au click quand l'image est agrandie.
J'ai ce script :On lui passe en param�tre l'id de l'image voulus.
Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 function fitit(image_id) { elt_image = document.getElementById(image_id); if (navigator.appName=="Netscape") windowWidth = window.innerWidth; if (navigator.appName.indexOf("Microsoft") != -1) windowWidth = document.body.offsetWidth; scaleWidth = windowWidth - 100; if (elt_image.width > scaleWidth || oldWidth > scaleWidth) { if (elt_image.width == scaleWidth) elt_image.width = oldWidth; else { oldWidth = elt_image.width; elt_image.style.cursor = "pointer"; elt_image.width = scaleWidth; } } }
Et le lien en html :L'histoire compl�te :
Code : S�lectionner tout - Visualiser dans une fen�tre � part <img id="img_affiche" onClick="fitit('img_affiche')" onLoad="fitit('img_affiche')" src="image.jpg" />
Le script regarde si la fenetre est assez grande pour afficher l'image entierement.
Si oui, il affiche l'image ...
Si non, il fait un truc pour que l'images soit r�tr�cie au dimension de la fen�tre, si on clique sur l'image, elle s'agrandie.
Dans les deux cas, elle finie par �tre agrandie, et j'aimerais caser un history.go(-1) au click.
Partager