Permalink
Browse files

script.aculo.us: Fix an issue with Effect.ScrollTo that caused Firefo…

…x 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
  • Loading branch information...
1 parent 47fa18a commit 115b86defe984a47e9fe61e4bdccd870b54edb82 @madrobby madrobby committed Jan 21, 2008
Showing with 43 additions and 1 deletion.
  1. +2 −0 CHANGELOG
  2. +1 −1 src/effects.js
  3. +39 −0 test/functional/effects5b_test.html
  4. +1 −0 test/functional/index.html
View
@@ -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)
View
@@ -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;
@@ -0,0 +1,39 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>script.aculo.us Effects functional test file</title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <script src="../../lib/prototype.js" type="text/javascript"></script>
+ <script src="../../src/scriptaculous.js" type="text/javascript"></script>
+ <script src="../../src/unittest.js" type="text/javascript"></script>
+</head>
+<body>
+
+<div style="height: 200px;">&nbsp;</div>
+
+<h1>script.aculo.us ScrollTo effect (with floats) functional test</h1>
+
+(this test only applies to Firefox)
+
+ <div style="float: right; padding: 10px; background: #ccc; height: 1900px;">
+
+ <h2>top of float</h2>
+
+ <a href="#" onclick="new Effect.ScrollTo('bottom-of-float');return false;">scroll to bottom!</a>
+
+ <div style="height: 1500px;">&nbsp;</div>
+
+ <h2 id="bottom-of-float">Bottom of Float</h2>
+
+ w00t
+
+ </div>
+
+ <script>
+ window.scrollBy(0, 200);
+ </script>
+
+
+</body>
+</html>
@@ -35,6 +35,7 @@
<li><a href="effects3_test.html" target="test">effects3_test</a></li>
<li><a href="effects4_test.html" target="test">effects4_test</a></li>
<li><a href="effects5_test.html" target="test">effects5_test</a></li>
+ <li><a href="effects5b_test.html" target="test">effects5b_test</a></li>
<li><a href="effects6_test.html" target="test">effects6_test</a></li>
<li><a href="effect_shake.html" target="test">effect shake</a></li>
<li><a href="effects_grow_strink_test.html" target="test">Grow/Shrink</a></li>

0 comments on commit 115b86d

Please sign in to comment.