Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2014
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>Boost Your Elo</title>
  4. <style>
  5. html,body{
  6. height:100%;
  7. width:100%;
  8. margin:0;
  9. padding:0;
  10. }
  11. section{
  12. position:relative;
  13. height:100%;
  14. width:100%;
  15. }
  16. section:nth-child(1){
  17. background:lightblue;
  18. }
  19. section:nth-child(2){
  20. background:lightgreen;
  21. }
  22. section:nth-child(3){
  23. background:purple;
  24. }
  25. section:nth-child(4){
  26. background:red;
  27. }
  28. section:nth-child(5){
  29. background:yellow;
  30. }
  31. </style>
  32. <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.js"></script>
  33. <script type='text/javascript' src="http://flesler-plugins.googlecode.com/files/jquery.scrollTo-1.4.2-min.js"></script>
  34. <script type='text/javascript' src="//cdnjs.cloudflare.com/ajax/libs/jquery-mousewheel/3.1.3/jquery.mousewheel.min.js"></script>
  35.  
  36. <script>
  37. $(document).ready(function()
  38. {
  39. $('body').mousewheel(function(event, delta) {
  40. var $current = $('section.inview');
  41.  
  42. if (delta > 0) {
  43. $prev = $current.prev();
  44.  
  45. if ($prev.length) {
  46. $('body').scrollTo($prev, 500);
  47. $current.removeClass('inview');
  48. $prev.addClass('inview');
  49. }
  50. } else {
  51. $next = $current.next();
  52.  
  53. if ($next.length) {
  54. $('body').scrollTo($next, 500);
  55. $current.removeClass('inview');
  56. $next.addClass('inview');
  57. }
  58. }
  59.  
  60. event.preventDefault();
  61. });
  62. });
  63. </script>
  64. </head>
  65. <body>
  66. <section id="about" class="inview">
  67. abc
  68. </section>
  69. <section>
  70. def
  71. </section>
  72. <section>
  73. ghi
  74. </section>
  75. <section>
  76. jkl
  77. </section>
  78. </body>
  79. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement