View Full Version : Add easing to mouse move script???

Jun 15th, 2012, 11:01 PM
Is it possible to add easing to this script?

<script type="text/javascript">
//Get our elements for faster access and set overlay width
var div = $('div.gallery-menu'),
ul = $('ul.gallery-menu'),
// unordered list's left margin
ulPadding = 15;
//Get menu width
var divWidth = div.width();
//Remove scrollbars
div.css({overflow: 'hidden'});
//Find last image container
var lastLi = ul.find('li:last-child');
//When user move mouse over menu
//As images are loaded ul width increases,
//so we recalculate it each time
var ulWidth = lastLi[0].offsetLeft + lastLi.outerWidth() + ulPadding;
var left = (e.pageX - div.offset().left) * (ulWidth-divWidth) / divWidth;