SHARE
TWEET

Untitled

a guest Jun 19th, 2017 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. div.container {
  2.   overflow:hidden;
  3.   width:200px;
  4.   height:200px;
  5. }
  6. div.content {
  7.   position:relative;
  8.   top:0;
  9. }
  10.  
  11. <div class="container">
  12.   <p>
  13.     <a href="enablejs.html" class="up">Up</a> /
  14.     <a href="enablejs.html" class="dn">Down</a>
  15.   </p>
  16.   <div class="content">
  17.     <p>Hello World</p>
  18.   </div>
  19. </div>
  20.  
  21. $(function(){
  22.   $(".container a.up").bind("click", function(){
  23.     var topVal = $(this).parents(".container").find(".content").css("top");
  24.     $(this).parents(".container").find(".content").css("top", topVal-10);
  25.   });
  26.  
  27.   $(".container a.dn").bind("click", function(){
  28.     var topVal = $(this).parents(".container").find(".content").css("top");
  29.     $(this).parents(".container").find(".content").css("top", topVal+10);
  30.   });
  31. });
RAW Paste Data
Top