irwan

jQuery - Hover

Oct 29th, 2011
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3.  
  4. <html xmlns="http://www.w3.org/1999/xhtml">
  5.  
  6. <head>
  7. <title>Hello!</title>
  8.  
  9. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
  10. <script type="text/javascript">
  11. $(function() {
  12. $('ul.hover_block li').hover(function(){
  13. $(this).find('img').animate({top:'182px'},{queue:false,duration:500});
  14. }, function(){
  15. $(this).find('img').animate({top:'0px'},{queue:false,duration:500});
  16. });
  17. });
  18.  
  19. </script>
  20.  
  21. </head>
  22.  
  23. <style>
  24. ul.hover_block li{
  25. list-style:none;
  26. float:left;
  27. background: #fff;
  28. padding: 10px;
  29. width:300px; position: relative;
  30. margin-right: 20px; }
  31.  
  32. ul.hover_block li a {
  33. display: block;
  34. position: relative;
  35. overflow: hidden;
  36. height: 150px;
  37. width: 268px;
  38. padding: 16px;
  39. color: #000;
  40. font: 1.6em/1.3 Helvetica, Arial, sans-serif;
  41. }
  42.  
  43. ul.hover_block li a { text-decoration: none; }
  44.  
  45. ul.hover_block li img {
  46. position: absolute;
  47. top: 0;
  48. left: 0;
  49. border: 0;
  50. }
  51. </style>
  52.  
  53. <body>
  54. <ul class="hover_block">
  55. <li><a href="/"><img src="http://profile.ak.fbcdn.net/hprofile-ak-snc4/188050_169149283138446_2377278_n.jpg" alt="alt" /> Hallo !</a></li>
  56. <li><a href="/"><img src="http://profile.ak.fbcdn.net/hprofile-ak-snc4/186443_100000022660365_1078381883_n.jpg" alt="alt" /> Hi! My Name..!</a></li>
  57. </ul>
  58.  
  59. </body>
  60. </html>
  61.  
Advertisement
Add Comment
Please, Sign In to add comment