index.html 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <!DOCTYPE html>
  2. <html lang="ja">
  3. <head>
  4. <meta charset="UTF-8">
  5. <link rel="stylesheet" href="css/style.css">
  6. <title>inertiaScroll</title>
  7. <!-- ga -->
  8. <script>
  9. (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  10. (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  11. m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  12. })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
  13. ga('create', 'UA-56791268-1', 'auto');
  14. ga('send', 'pageview');
  15. </script>
  16. <!-- / ga -->
  17. </head>
  18. <body>
  19. <div id="content">
  20. <header>header!</header>
  21. <div id="box1" class="box" data-speed="1" data-margin="100"></div>
  22. <div id="box2" class="box" data-speed="7"></div>
  23. <div id="box3" class="box" data-speed="2"></div>
  24. <div id="box4" class="box" data-speed="5"></div>
  25. <div id="box5" class="box" data-speed="3" data-margin="200"></div>
  26. <div id="box6" class="box" data-speed="1"></div>
  27. <div id="box7" class="box" data-speed="2"></div>
  28. <div id="box8" class="box" data-speed="8"></div>
  29. <div id="box9" class="box" data-speed="1"></div>
  30. <div id="box10" class="box" data-speed="5"></div>
  31. <footer>footer!</footer>
  32. </div>
  33. <script src="jquery-1.9.1.js"></script>
  34. <script src="jquery-inertiaScroll.js"></script>
  35. <script>
  36. $(function(){
  37. $(".box").inertiaScroll({
  38. parent: $("#content")
  39. });
  40. $(".box").each(function(){
  41. var speed = $(this).data("speed");
  42. var height = $(this).height() + "px";
  43. $(this).css("line-height",height).text(speed);
  44. });
  45. });
  46. </script>
  47. </body>
  48. </html>