Advertisement
asimryu

20150922코딩연습3

Sep 22nd, 2015
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.15 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>HTML5</title>
  6. <style>
  7. body { margin:0; }
  8. .wrap {
  9.     width:1000px;
  10.     margin:0 auto;
  11. }
  12. header {
  13. width:100%;
  14. height:300px;
  15. background-image:url(images/main.jpg);
  16. background-position: center;
  17. }
  18. nav {
  19.     width:100%;
  20.     height: 50px;
  21.     background-color:rgb(0,0,0);
  22. }
  23. nav a {
  24.     padding:0 10px;
  25.     height:50px;
  26.     color:white;
  27.     font-size: 1.7em;
  28.     line-height:50px;
  29.     display:inline-block;
  30.     text-decoration:none;
  31. }
  32. nav a:hover {
  33.     background-color:#f00;
  34. }
  35. section, aside { float:left; min-height:400px; }
  36. section { width:640px; }
  37. aside { width:360px; }
  38. footer {
  39.     clear:both;
  40.     width:100%;
  41.     height: 50px;
  42.     line-height: 50px;
  43.     color: white;
  44.     text-align: center;
  45.     background-color:#000;
  46. }
  47. .slide {
  48.     position:relative;
  49.     width:640px;
  50.     height:480px;
  51.     /* overflow:hidden; */
  52. }
  53. .slide > img {
  54.     position: absolute;
  55.     width: 640px;
  56.     height: 480px;
  57.     left: 0;
  58.     top: 0;
  59.     opacity: 0;
  60. }
  61. </style>
  62. </head>
  63. <body>
  64.     <div class="wrap">
  65.         <header></header>
  66.         <nav>
  67.             <a href="#">HOME</a>
  68.             <a href="#">JavaScript</a>
  69.             <a href="#">CSS</a>
  70.             <a href="#">PHP&amp;MySql</a>
  71.         </nav>
  72.         <div class="main">
  73.             <section>
  74.                 <article class="slide">
  75.                     <img src="images/1.jpg">
  76.                     <img src="images/2.jpg">
  77.                     <img src="images/3.jpg">
  78.                     <img src="images/4.jpg">
  79.                     <img src="images/5.jpg">
  80.                 </article>
  81.             </section>
  82.             <aside>
  83.             </aside>
  84.         </div>
  85.         <footer>&copy;2015 유승열 All Rights Reserved</footer>
  86.     </div>
  87.     <script src="http://code.jquery.com/jquery-latest.js"></script>
  88. <script>
  89. var sno = 0;
  90. var slides = $(".slide > img");
  91. var max = slides.length - 1;
  92. $( slides[sno] ).css("opacity",1);
  93. $(".slide").click(function(){
  94.     $( slides[sno] ).animate({"opacity":0},2000);
  95.     sno = sno + 1; //sno++
  96.     if( sno > max ) sno = 0;
  97.     $( slides[sno] ).animate({"opacity":1},2000);
  98. });
  99. var timer = setInterval(function(){ $(".slide").click(); },2000);
  100. </script>
  101. </body>
  102. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement