Hello, I'm trying to make my hover-action with slowly bg-image changing.
.menu_part
{
border-left: 1px solid black;
background-image: url(../images/bg_menu.png);
float:left;
padding: 2px 10px;
}
.menu_part:hover
{
background-image: url(../images/bg_menu_hove.png);
color: #FFF;
}
Menu:
<div id="head_menu">
<a href="#order"><div>make order</div></a>
<a href="#portfolio"><div>portfolie</div></a>
<a href="#contacts"><div>contacts</div></a>
<a href="#vacancies"><div>vacancies</div></a>
<a href="#about"><div>about company</div></a>
</div>
Some JQuery:
$('#head_menu a').addClass('menu_part');
Now I'm trying to write hover-action for selector $('#head_menu a'). Could i change bg-image to need, when hover, slowly?
Here is my trying-code:
$("#head_menu a").hover(
function() {
$(this).animate({backgroundImage: 'url(images/bg_menu_hove.png)', color: '#fff'}, 1000);
},
function() {
$(this).animate({backgroundImage: 'url(images/bg_menu.png)', color: '#000'}, 1000);
}
);
But it even doesn't show menu now. What i did wrong? And I'll also try to use bg-position.
Here is code with bg-position, I can't understand. I merged bg_menu.png and bg_menu_hove.png into 1 image 200px+200px. Style above doesn't work even without JQuery.
.menu_part:hover
{
background-image: url(../images/new_menu.png);
background-position: 0 -200px;
}