non-stretching background?

non-stretching background?

I'm trying to make a nav menu. I've not done much jquery before, but have managed to get this far. 
I expected the default behavior to not stretch the background image, but it does.
Is there a css3 tag or some other approach I can use to prevent the background from stretching when I change the height of the div?

Here's my menu so far...
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <title></title>
  6. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
  7. <script type="text/javascript">
  8. var lastY = 0;
  9. var direction = '';
  10. $(document).ready(function()
  11. {
  12. $('body').mousemove(
  13. function(e){
  14. if (e.pageY < lastY) direction = 'up';
  15. else direction = 'down';
  16. lastY = e.pageY;
  17. if (direction == 'down')
  18. {
  19. $('.box').hover(
  20. function(){
  21. $(this).find('.layer').stop().animate({'height': '30px'}, 'fast');
  22. $(this).find('.layer').css('bottom', '').css('top', '0');
  23. },
  24. function(){
  25. $(this).find('.layer').stop().animate({'height': '0px'}, 'fast');
  26. $(this).find('.layer').css('top', '').css('bottom', '0');
  27. });
  28. }
  29. if (direction == 'up')
  30. {
  31. $('.box').hover(
  32. function(){
  33. $(this).find('.layer').stop().animate({'height': '30px'}, 'fast');
  34. $(this).find('.layer').css('top', '').css('bottom', '0');
  35. },
  36. function(){
  37. $(this).find('.layer').stop().animate({'height': '0px'}, 'fast');
  38. $(this).find('.layer').css('bottom', '').css('top', '0');
  39. });
  40. }
  41. });
  42. });
  43. </script>
  44. <style>
  45. .box {
  46. border: 1px solid #07A;
  47. height: 30px;
  48. width: 150px;
  49. position: relative;
  50. }
  51. .layer {
  52. background: #09C url(../images/darkbluefill.png);
  53. background: url(http://blog.pixelingene.com/images/2008-09-23-quick-tip-to-get-a-striped-background/image4.png);
  54. height: 0px;
  55. width: 150px;
  56. position: absolute;
  57. left: 0;
  58. }
  59. </style>
  60. <body>
  61. <div class="box">
  62. <div class="layer"></div>
  63. </div>
  64. <div class="box">
  65. <div class="layer"></div>
  66. </div>
  67. <div class="box">
  68. <div class="layer"></div>
  69. </div>
  70. <div class="box">
  71. <div class="layer"></div>
  72. </div>
  73. <div class="box">
  74. <div class="layer"></div>
  75. </div>
  76. <div class="box">
  77. <div class="layer"></div>
  78. </div>
  79. </body>
  80. </html>