Skip to content

Commit

Permalink
script.aculo.us: Fix an issue with Effect.ScrollTo that caused Firefo…
Browse files Browse the repository at this point in the history
…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
madrobby committed Jan 21, 2008
1 parent 47fa18a commit 115b86d
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 1 deletion.
2 changes: 2 additions & 0 deletions 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)
Expand Down
2 changes: 1 addition & 1 deletion src/effects.js
Expand Up @@ -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;

Expand Down
39 changes: 39 additions & 0 deletions test/functional/effects5b_test.html
@@ -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>
1 change: 1 addition & 0 deletions test/functional/index.html
Expand Up @@ -35,6 +35,7 @@ <h2>Effects</h2>
<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>
Expand Down

0 comments on commit 115b86d

Please sign in to comment.