- commit
- 54aed11b8bb21219652250d2eae7f443ca522d6a
- parent
- 3ef391e196964365e93133af7bcc5c488922fc70
- Author
- leaf corcoran <leafot@gmail.com>
- Date
- 2013-07-31 16:44
add scroll it buttons
Diffstat
| M | site/example.coffee | 23 | +++++++++++++++++++++++ |
| M | site/examples/4.html | 4 | ++++ |
| M | site/main.coffee | 6 | ++++++ |
| M | site/templates/index.html | 3 | ++- |
4 files changed, 35 insertions, 1 deletions
diff --git a/site/example.coffee b/site/example.coffee
@@ -3,3 +3,26 @@ 3 3 $ -> 4 4 $("[data-sticky_column]").stick_in_parent() 5 5 -1 6 window.scroll_it = -> -1 7 max = $(document).height() - $(window).height() -1 8 $("body,html") -1 9 .stop(true) -1 10 .animate({ scrollTop: max }, max*3) -1 11 .delay(100) -1 12 .animate({ scrollTop: 0 }, max*3) -1 13 -1 14 window.scroll_it_wobble = -> -1 15 max = $(document).height() - $(window).height() -1 16 third = Math.floor max / 3 -1 17 -1 18 $("body,html") -1 19 .stop(true) -1 20 .animate({ scrollTop: third * 2 }, max*3) -1 21 .delay(100) -1 22 .animate({ scrollTop: third }, max*3) -1 23 .delay(100) -1 24 .animate({ scrollTop: max }, max*3) -1 25 .delay(100) -1 26 .animate({ scrollTop: 0 }, max*3) -1 27 -1 28
diff --git a/site/examples/4.html b/site/examples/4.html
@@ -21,3 +21,7 @@ 21 21 <div class="footer"> 22 22 My very tall footer! 23 23 </div> -1 24 -1 25 <script type="text/javascript"> -1 26 scroll_it = scroll_it_wobble -1 27 </script>
diff --git a/site/main.coffee b/site/main.coffee
@@ -0,0 +1,6 @@
-1 1
-1 2 $ ->
-1 3 $("body").on "click", ".example_controls button", (e) =>
-1 4 $(e.currentTarget)
-1 5 .closest(".example").find("iframe")[0].contentWindow.scroll_it()
-1 6
diff --git a/site/templates/index.html b/site/templates/index.html
@@ -5,11 +5,12 @@ 5 5 <title></title> 6 6 7 7 <link rel="stylesheet" href="$root/main.css" /> -1 8 <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script> 8 9 <script type="text/javascript" src="$root/main.js"></script> 9 10 </head> 10 11 <body> 11 12 12 13 $body13 -1-1 14 14 15 </body> 15 16 </html>