Advertisement
Guest User

Untitled

a guest
Sep 20th, 2012
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.79 KB | None | 0 0
  1. <!doctype html>
  2. <html>
  3.     <head>
  4.         <title>News</title>
  5.         <style>
  6.             html {
  7.                 font-family: "Arial";
  8.             }
  9.             .title {
  10.                 font-family: "Segoe UI Light";
  11.                 font-size: 200%;
  12.             }
  13.         </style>
  14.         <script src="jquery.js"></script>
  15.         <script>
  16.             $(document).ready(
  17.                 function(){
  18.                     //Hide the article's bodies
  19.                     $(".article .body").hide();
  20.                     //Add the read body button
  21.                     $("#container").find(".article .actions").prepend("<button class='readbody'>Read Body</button>");
  22.                     //Add the onclick action to the button
  23.                     $(".actions .readbody").click(
  24.                         function(event){
  25.                             var mybody = this.parentNode.parentNode;
  26.                             while (mybody = mybody.previousSibling) {
  27.                                 if (mybody.className == "body") break;
  28.                             };
  29.                             $(mybody).toggle();
  30.                         }
  31.                     );
  32.                 }
  33.             );
  34.         </script>
  35.     </head>
  36.     <body>
  37.         <div id="container">
  38.             <div class="article">
  39.                 <div class="title">
  40.                     Title #1
  41.                 </div>
  42.                 <div class="summary">
  43.                     Summary #1
  44.                 </div>
  45.                 <div class="body">
  46.                     Article body #1
  47.                 </div>
  48.                 <div class="actions">
  49.                     <button>Comment</button>
  50.                     <button>Share</button>
  51.                 </div>
  52.             </div>
  53.             <hr/>
  54.             <div class="article">
  55.                 <div class="title">
  56.                     Title #2
  57.                 </div>
  58.                 <div class="summary">
  59.                     Summary #2
  60.                 </div>
  61.                 <div class="body">
  62.                     Article body #2
  63.                 </div>
  64.                 <div class="actions">
  65.                     <button>Comment</button>
  66.                     <button>Share</button>
  67.                 </div>
  68.             </div>
  69.             <hr/>
  70.             <div class="article">
  71.                 <div class="title">
  72.                     Title #3
  73.                 </div>
  74.                 <div class="summary">
  75.                     Summary #3
  76.                 </div>
  77.                 <div class="body">
  78.                     Article body #3
  79.                 </div>
  80.                 <div class="actions">
  81.                     <button>Comment</button>
  82.                     <button>Share</button>
  83.                 </div>
  84.             </div>
  85.         </div>
  86.     </body>
  87. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement