javascript - Jquery animate on background position not working -
can tell me why jquery isnt working?
i have list so:
<div id="services"> <h1>services</h1> <ul> <li class="menu"><a href="#">menu item1</a></li> <li class="menu"><a href="#">menu item2</a></li> <li class="menu"><a href="#">menu item3</a></li> <li class="menu"><a href="#">menu item4</a></li> </ul> </div> and want slide in background image left on hover , reverse on mouseout.
the following jquery code isnt doing on moueover or mouseout. missing here?
$(function(){ $('li.menu a').css( {backgroundposition: "-416px 0"}) .mouseover(function(){ $(this).stop().animate({backgroundposition:"(0px 0px)"}, 500) }) .mouseout(function(){ $(this).stop().animate({backgroundposition:"(-416px 0)"}, 500) }); });
you have luck:) run in same issue yesterday. see you, same i, need animation on x axis.
so need pass single parameter backgroundposition, default x axis. pass int, default pixels.
$('li.menu a').css({ backgroundposition: -416 }).mouseover(function(){ $(this).stop().animate({backgroundposition: 0}, 500) }).mouseout(function(){ $(this).stop().animate({backgroundposition: -416}, 500) });
Comments
Post a Comment