issue102, add now function which finds out the correct thumbnail position also in IE
[phpfspot.git] / phpfspot.js
index ad4a63e088bdc12ee06f5227a0ac8dc329cb9625..7e18d3c5fcd63ae37b8f5550982c271f24cb9042 100644 (file)
@@ -29,11 +29,21 @@ function moveToThumb(thumb_id)
       return;
 
    if(thumbimg = document.getElementById('thumbimg' + thumb_id)) {
-      window.scrollTo(0, thumbimg.offsetTop-100);
+      window.scrollTo(0, findPos(thumbimg)-100);
    }
 
 } // moveToThumb()
 
+function findPos(obj) {
+   var curtop = 0;
+   if (obj.offsetParent) {
+      do {
+         curtop += obj.offsetTop;
+      } while (obj = obj.offsetParent);
+   }
+   return [curtop];
+}
+
 function showCredits()
 {
    var credits = document.getElementById("content");