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 :
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;
		}
	}
}
On lui passe en paramètre l'id de l'image voulus.

Et le lien en html :
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" />
L'histoire complète :
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.