Guest

Hover Div System

By: a guest on Feb 23rd, 2012  |  syntax: None  |  size: 0.85 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  1. $(".container").hover(function() {
  2.     $(this).find(".hover").fadeIn();
  3. }, function() {
  4.     $(this).find(".hover").fadeOut();
  5. });
  6.        
  7. <div class="container">
  8.     <div class="hover">
  9.         Content Here
  10.     </div>
  11.     <a href="#">Link</a>
  12. </div>
  13.        
  14. .container, .hover { width: 100px; height: 300px; background: white; }
  15. .hover { position: absolute; display: none; }
  16.        
  17. <div id="container">
  18.   <a href="#" id="link">Link</a>
  19.   <div id="divtofadein">some content here</div>
  20. </div>
  21.        
  22. $(function(){
  23.  $("#divtofadein").mouseout(function(){
  24.   $(this).fadeOut();
  25.  })
  26.    .hide();
  27.  
  28.  $("#link").click(function(){
  29.   $("#divtofadein").fadeIn();
  30.  });
  31. });
  32.        
  33. #container {
  34. position: relative;
  35. width: 100px;
  36. height: 200px;
  37. }
  38.  
  39. #link {
  40. position: absolute;
  41. top: 0px;
  42. left: 0px;
  43. }
  44.  
  45. #divtofadein {
  46. position: absolute;
  47. top: 0px;
  48. left: 0px;
  49. width: 100px;
  50. height: 200px;
  51. background: #FFF;
  52. }