Use the animate function step (it is not documented) ... I updated the demo
var panels = $('#promo li'); panels.hoverIntent( function() { if (!$(this).is('.expanded') && !panels.is(':animated')) { $(this).animate({ width: 200 }, { // width is the calculated width, ani is the animation object step: function(width, ani) { var w = Math.floor(width); // use 250 so we end up with 50 as the reduced size $('.expanded').css('width', (250 - w) + 'px'); $(ani.elem).css('width', (200 - w) + 'px'); }, duration: 500, complete: function() { panels.removeClass('expanded'); $(this).addClass('expanded'); } }); } }, function() {});
A similar method is used in the Kwicks plugin.
source share