You can use jQuery's animate to do something to an element, which includes a duration parameter that defines how long it should take for the animation to complete. Then there's the hover
function which takes a set of functions. So this is the general idea:
$('div', '#nav_container').hover(function() {
// this gets called on hover
$(this).animate({width: 'XXXpx'}, 10000); // 10000 = 10 seconds
}, function() {
// this gets called on mouseout
$(this).animate({width: 'XXXpx'}, 10000); // 10000 = 10 seconds
});
EDIT:
As far as your comment, if the code is in the <HEAD>
, you need to wrap the code in document.ready
:
$(document).ready(function() {
// put the code you tried here
});