MTrackWeb/templates/images/js/mtrack2.js
authorAlan Knowles <alan@akbkhome.com>
Thu, 2 Jun 2011 10:06:39 +0000 (18:06 +0800)
committerAlan Knowles <alan@akbkhome.com>
Thu, 2 Jun 2011 10:06:39 +0000 (18:06 +0800)
MTrackWeb/templates/images/js/mtrack2.js

index 77e6eb2..bf0ff32 100644 (file)
@@ -214,7 +214,56 @@ MTrack = {
         });
         
     }
+    
+    function footerPosition(force) {
+        var ele = Roo.get('footer');
+        if (!force &&
+            (last_dh != Roo.lib.Dom.getDocumentHeight() || last_wh != Roo.lib.Dom.getViewHeight())) {
+          force = true;
+        }
         
+        if (force) {
+          // Force a from-scratch layout assessment; put the footer back in
+          // it's natural location in the doc
+          ele.setStyle({
+            position: "relative",
+            "margin-top": "3em",
+            top: 0
+          });
+        }
+        if (Roo.lib.Dom.getDocumentHeight() <= Roo.lib.Dom.getViewHeight()) {
+          ele.setStyle({
+            position: "absolute",
+            "margin-top": "0",
+            top: (
+                Roo.get(window).getScroll().top +
+                 Roo.lib.Dom.getViewHeight() -
+                ele.getSize().height - 1
+              )+"px"
+          });
+        } else {
+          ele.setStyle({
+            position: "relative",
+            "margin-top": "3em"
+          });
+        }
+        last_dh = $(document).height();
+        last_wh = $(window).height();
+      }
+      window.mtrack_footer_position = mtrack_footer_position;
+      $(window)
+        .scroll(mtrack_footer_position)
+        .resize(mtrack_footer_position);
+      function mtrack_footer_set_and_wait() {
+        mtrack_footer_position();
+        setTimeout(function () {
+          mtrack_footer_set_and_wait();
+        }, 1500);
+      }
+      mtrack_footer_set_and_wait();
+    });
+    
+    
         
 }