Advertisement
deko96

Untitled

Oct 28th, 2015
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.68 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head lang="en">
  4.     <meta charset="UTF-8">
  5.     <title>vezba 1</title>
  6.     <script type="text/javascript" src="http://code.jquery.com/jquery-1.11.3.js"></script>
  7.     <script type="text/javascript">
  8.  
  9.         $(document).ready(function(){
  10.             $(".accordion p").hide();
  11.             $(".accordion").click(function() {
  12.                 $(this).find("p").slideDown("fast", function() {
  13.                     $(".accordion p").not(this).slideUp("fast");
  14.                     $(this).addClass("newP");
  15.                     $(".accordion p").not(this).removeClass("newP");
  16.                 });
  17.                 var tmp = $(this).find("h2");
  18.                 tmp.addClass("new");
  19.                 $(".accordion h2").not(tmp).removeClass("new");
  20.  
  21.             });
  22.         });
  23.     </script>
  24.     <style>
  25.         .newP{
  26.             background-color: cornflowerblue;
  27.         }
  28.         .new{
  29.             background-color:lightgreen;
  30.         }
  31.  
  32.         div{
  33.             width:500px;
  34.             background-color: #ffada3;
  35.         }
  36.         h2{
  37.             background-color: #fff587;
  38.         }
  39.     </style>
  40.  
  41. </head>
  42. <body>
  43.  
  44. <div>
  45. <h1>Custom Accordion</h1>
  46. <div class="accordion">
  47.     <div><h2>Accordion 1</h2></div>
  48.     <div><p>Now we are engaged in a great civil war, testing whether that nation or any nation so conceived and so dedicated can long endure. We are met on a great battlefield of that war. We have come to dedicate a portion of that field as a final resting-place for those who here gave their lives that that nation might live. It is altogether fitting and proper that we should do this.But, in a larger sense, we cannot dedicate, we cannot consecrate, we cannot hallow this ground.</p></div>
  49. </div>
  50.  
  51. <div class="accordion">
  52.     <div><h2>Accordion 2</h2></div>
  53.     <div><p>The brave men, living and dead who struggled here have consecrated it far above our poor power to add or detract. The world will little note nor long remember what we say here, but it can never forget what they did here. It is for us the living rather to be dedicated here to the unfinished work which they who fought here have thus far so nobly advanced.</p></div>
  54. </div>
  55.  
  56. <div class="accordion">
  57.     <div><h2>Accordion 3</h2></div>
  58.     <div><p>It is rather for us to be here dedicated to the great task remaining before us -- that from these honored dead we take increased devotion to that cause for which they gave the last full measure of devotion -- that we here highly resolve that these dead shall not have died in vain, that this nation under God shall have a new birth of freedom, and that government of the people, by the people, for the people shall not perish from the earth.</p></div>
  59. </div>
  60.  
  61. </div>
  62. </body>
  63. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement