diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-12-28 20:16:09 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2014-12-28 20:16:33 -0500 |
commit | f130c7d877a14a44dfa3060d510b8ec41eea2771 (patch) | |
tree | b435e11225b42b849ba5092bf733a7867dc7c727 | |
parent | ba7f78fc74aab4bcf91d5effa4ebdfe310112b58 (diff) | |
download | sqlalchemy-f130c7d877a14a44dfa3060d510b8ec41eea2771.tar.gz |
- merge the safari-related changes to init.js from zzzeeksphinx
(cherry picked from commit a2fc048775e3a9104db20881fa333bd7695d24ff)
-rw-r--r-- | doc/build/static/init.js | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/doc/build/static/init.js b/doc/build/static/init.js index 4bcb4411d..70c6f4616 100644 --- a/doc/build/static/init.js +++ b/doc/build/static/init.js @@ -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) |