1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
---|
2 | <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="fr-FR"> |
---|
3 | <head profile="http://gmpg.org/xfn/11"> |
---|
4 | <title>Test case: too much recursion with animation</title> |
---|
5 | <script type="text/javascript" src="http://jquery.com/src/_jquery-latest.js"></script> |
---|
6 | <script type="text/javascript" src="jquery.js"></script> |
---|
7 | <script type="text/javascript"> |
---|
8 | $.fn.fixedScroll = function(speed, easing, callback){ |
---|
9 | var self = this.css('position', 'relative'), |
---|
10 | animate = $.extend({queue: false}, $.speed(speed, easing, callback)); |
---|
11 | $(document).scroll(function(){ |
---|
12 | self.animate({top: $(this).scrollTop()}, animate);// this will bug "too much recursion" |
---|
13 | //self.animate({top: $(this).scrollTop()}, $.extend({}, animate));// this works... |
---|
14 | }); |
---|
15 | } |
---|
16 | $(function(){ |
---|
17 | $('#fixed').fixedScroll(); |
---|
18 | }); |
---|
19 | </script> |
---|
20 | </head> |
---|
21 | <body> |
---|
22 | <div style="height:2000px"><p id="fixed">this text should scroll with the page</p></div> |
---|
23 | </body> |
---|
24 | </html> |
---|