From 115b86defe984a47e9fe61e4bdccd870b54edb82 Mon Sep 17 00:00:00 2001 From: Thomas Fuchs Date: Mon, 21 Jan 2008 23:22:29 +0000 Subject: [PATCH] script.aculo.us: Fix an issue with Effect.ScrollTo that caused Firefox to scroll to the wrong offset in some situations. Closes #10245. git-svn-id: http://svn.rubyonrails.org/rails/spinoffs/scriptaculous@8686 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- CHANGELOG | 2 ++ src/effects.js | 2 +- test/functional/effects5b_test.html | 39 +++++++++++++++++++++++++++++ test/functional/index.html | 1 + 4 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 test/functional/effects5b_test.html diff --git a/CHANGELOG b/CHANGELOG index 6e7372a..868f900 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +* Fix an issue with Effect.ScrollTo that caused Firefox to scroll to the wrong offset in some situations. Closes #10245. [nik.wakelin] + * Fixes an issue with IE ghosting on non-absolute elements. Closes #10423. [Tanrikut, tdd] *V1.8.1* (January 3, 2008) diff --git a/src/effects.js b/src/effects.js index 65fce6e..718a88d 100644 --- a/src/effects.js +++ b/src/effects.js @@ -509,7 +509,7 @@ Effect.ScrollTo = function(element) { var options = arguments[1] || { }, scrollOffsets = document.viewport.getScrollOffsets(), elementOffsets = $(element).cumulativeOffset(), - max = (window.height || document.body.scrollHeight) - document.viewport.getHeight(); + max = document.viewport.getScrollOffsets[0] - document.viewport.getHeight(); if (options.offset) elementOffsets[1] += options.offset; diff --git a/test/functional/effects5b_test.html b/test/functional/effects5b_test.html new file mode 100644 index 0000000..160f29d --- /dev/null +++ b/test/functional/effects5b_test.html @@ -0,0 +1,39 @@ + + + + script.aculo.us Effects functional test file + + + + + + + +
 
+ +

script.aculo.us ScrollTo effect (with floats) functional test

+ +(this test only applies to Firefox) + +
+ +

top of float

+ + scroll to bottom! + +
 
+ +

Bottom of Float

+ + w00t + +
+ + + + + + \ No newline at end of file diff --git a/test/functional/index.html b/test/functional/index.html index cc1e606..72ff3c4 100644 --- a/test/functional/index.html +++ b/test/functional/index.html @@ -35,6 +35,7 @@

Effects

  • effects3_test
  • effects4_test
  • effects5_test
  • +
  • effects5b_test
  • effects6_test
  • effect shake
  • Grow/Shrink