]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- merge the safari-related changes to init.js from zzzeeksphinx
authorMike Bayer <mike_mp@zzzcomputing.com>
Mon, 29 Dec 2014 01:16:09 +0000 (20:16 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Mon, 29 Dec 2014 01:16:09 +0000 (20:16 -0500)
doc/build/static/init.js

index 4bcb4411daaac9820b43dbd8c7a89a9b1e814a4f..70c6f46161d741721dce7fa2bbf353c01b23a8da 100644 (file)
@@ -13,21 +13,36 @@ function initFloatyThings() {
 
     automatedBreakpoint = $("#docs-container").position().top + $("#docs-top-navigation-container").height();
 
+    left = $("#fixed-sidebar.withsidebar").offset()
+    if (left) {
+        left = left.left;
+    } // otherwise might be undefined
+
+    // we use a "fixed" positioning for the sidebar regardless
+    // of whether or not we are moving with the page or not because
+    // we want it to have an independently-moving scrollbar at all
+    // times.  Otherwise, keeping it with plain positioning before the
+    // page has scrolled works more smoothly on safari, IE
     $("#fixed-sidebar.withsidebar").addClass("preautomated");
 
-
-    function setScroll() {
-
+    function setScroll(event) {
         var scrolltop = $(window).scrollTop();
-        if (scrolltop >= automatedBreakpoint) {
+        if (scrolltop < 0) {
+            // safari does this
+            $("#fixed-sidebar.withsidebar").css(
+                "top", $("#docs-body").offset().top - scrolltop);
+        }
+        else if (scrolltop >= automatedBreakpoint) {
             $("#fixed-sidebar.withsidebar").css("top", 5);
         }
         else {
-            $("#fixed-sidebar.withsidebar").css(
+          $("#fixed-sidebar.withsidebar").css(
                 "top", $("#docs-body").offset().top - Math.max(scrolltop, 0));
         }
 
-
+        var scrollside = $(window).scrollLeft();
+        // more safari crap, side scrolling
+        $("#fixed-sidebar.withsidebar").css("left", left - scrollside);
     }
     $(window).scroll(setScroll)