Browse Source

! minor update to expandthumb to support mods and entered user image sizes

Spuds 12 years ago
parent
commit
ea188122c5
1 changed files with 15 additions and 4 deletions
  1. 15 4
      Themes/default/scripts/topic.js

+ 15 - 4
Themes/default/scripts/topic.js

@@ -558,11 +558,22 @@ function expandThumb(thumbID)
 {
 	var img = document.getElementById('thumb_' + thumbID);
 	var link = document.getElementById('link_' + thumbID);
-	var tmp = img.src;
+	
+	// save the currently displayed image attributes
+	var tmp_src = img.src;
+	var tmp_height = img.style.height;
+	var tmp_width = img.style.width;
+	
+	// set the displayed image attributes to the link attributes, this will expand in place
 	img.src = link.href;
-	link.href = tmp;
-	img.style.width = '';
-	img.style.height = '';
+	img.style.width = link.style.width;
+	img.style.height = link.style.height;
+	
+	// place the image attributes back
+	link.href = tmp_src;
+	link.style.width = tmp_width;
+	link.style.height = tmp_height;
+	
 	return false;
 }