Advertisement
Guest User

buwfc

a guest
Jan 28th, 2015
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.94 KB | None | 0 0
  1. //THIS IS CSS
  2.  
  3. /* Initial body */
  4. body {
  5. left: 0;
  6. margin: 0;
  7. overflow: hidden;
  8. position: relative;
  9. }
  10.  
  11. /* Initial menu */
  12. .menu {
  13. background: #202024 url('http://s3.amazonaws.com/codecademy-content/courses/ltp2/img/uber/black-thread.png') repeat left top;
  14. left: -285px; /* start off behind the scenes */
  15. height: 100%;
  16. position: fixed;
  17. width: 285px;
  18. }
  19.  
  20. /* Basic styling */
  21.  
  22. .jumbotron {
  23. background-image: url('http://s3.amazonaws.com/codecademy-content/courses/ltp2/img/uber/bg.png');
  24. height: 100%;
  25. -webkit-background-size: cover;
  26. -moz-background-size: cover;
  27. -o-background-size: cover;
  28. background-size: cover;
  29. }
  30.  
  31. .menu ul {
  32. border-top: 1px solid #636366;
  33. list-style: none;
  34. margin: 0;
  35. padding: 0;
  36. }
  37.  
  38. .menu li {
  39. border-bottom: 1px solid #636366;
  40. font-family: 'Open Sans', sans-serif;
  41. line-height: 45px;
  42. padding-bottom: 3px;
  43. padding-left: 20px;
  44. padding-top: 3px;
  45. }
  46.  
  47. .menu a {
  48. color: #fff;
  49. font-size: 15px;
  50. text-decoration: none;
  51. text-transform: uppercase;
  52. }
  53.  
  54. .icon-close {
  55. cursor: pointer;
  56. padding-left: 10px;
  57. padding-top: 10px;
  58. }
  59.  
  60. .icon-menu {
  61. color: #fff;
  62. cursor: pointer;
  63. font-family: 'Open Sans', sans-serif;
  64. font-size: 16px;
  65. padding-bottom: 25px;
  66. padding-left: 25px;
  67. padding-top: 25px;
  68. text-decoration: none;
  69. text-transform: uppercase;
  70. }
  71.  
  72. .icon-menu i {
  73. margin-right: 5px;
  74. }
  75.  
  76.  
  77.  
  78. //This is HTML
  79.  
  80. <html>
  81. <head>
  82. <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
  83. <link href='http://fonts.googleapis.com/css?family=Open+Sans:400;300' rel='stylesheet' type='text/css'>
  84. <link href='style.css' rel='stylesheet'>
  85.  
  86. </head>
  87. <body>
  88.  
  89. <div class="menu">
  90.  
  91. <!-- Menu icon -->
  92. <div class="icon-close">
  93. <img src="http://s3.amazonaws.com/codecademy-content/courses/ltp2/img/uber/close.png">
  94. </div>
  95.  
  96. <!-- Menu -->
  97. <ul>
  98. <li><a href="#">About</a></li>
  99. <li><a href="#">Blog</a></li>
  100. <li><a href="#">Help</a></li>
  101. <li><a href="#">Contact</a></li>
  102. </ul>
  103. </div>
  104.  
  105. <!-- Main body -->
  106. <div class="jumbotron">
  107.  
  108. <div class="icon-menu">
  109. <i class="fa fa-bars"></i>
  110. Menu
  111. </div>
  112.  
  113. <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
  114. <script src="app.js"></script>
  115. </body>
  116. </html>
  117.  
  118.  
  119. /THIS IS JAVA SCRIPT
  120.  
  121.  
  122. var main = function() {
  123. /* Push the body and the nav over by 285px over */
  124. $('.icon-menu').click(function() {
  125. $('.menu').animate({
  126. left: "0px"
  127. }, 200);
  128.  
  129. $('body').animate({
  130. left: "285px"
  131. }, 200);
  132. });
  133.  
  134. /* Then push them back */
  135. $('.icon-close').click(function() {
  136. $('.menu').animate({
  137. left: "-285px"
  138. }, 200);
  139.  
  140. $('body').animate({
  141. left: "0px"
  142. }, 200);
  143. });
  144. };
  145.  
  146.  
  147. $(document).ready(main);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement