2012-01-26 116 views
0

有一个菜单栏和一个标题。 我想要不同的菜单项更改标题图像。菜单和标题

没有悬停 - >缺省头图像

MENU1悬停 - >变化头image1的

MENU2悬停 - >变化头IMAGE2

菜单3悬停 - >变化头图像3

我用photoshop制作:http://bogdany.malafree.hu/pic.jpg

对不起英语不好... 我在等待答案

回答

0

你必须把标题图像放在菜单里面。然后你可以这样做:

.menu1:hover div.header1 { 
     background-image:url(/header2.jpg); 

} 
0

使用jquery,也许?像这样:

$(document).ready(function() { 
    // #menu is the id of either the container div or the ul 
    $('#menu li').hover(
     function() { 
      var index = $('#menu li').index(this); 
      //#header is the ID of your header image 
      $('#header').attr('src','../imgs/your_image_name'+index+'.jpg'); 

     }, 
     function() { 
      $('#header').attr('src','../imgs/your_image_name.jpg'); 
     } 
}):