slider: use handle width / 2 instead of marginLeft to find offset of mousedown relative to center of handle (fixes #4063 - slider: horizontal slider handle jumps up when you click on it IE6)

This commit is contained in:
Richard Worth 2009-02-28 20:45:05 +00:00
parent cacb2acee4
commit 5b00c21719

View File

@ -222,7 +222,7 @@ $.widget("ui.slider", $.extend({}, $.ui.mouse, {
var offset = closestHandle.offset();
var mouseOverHandle = !$(event.target).parents().andSelf().is('.ui-slider-handle');
this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {
left: event.pageX - offset.left + (parseInt(closestHandle.css('marginLeft'),10) || 0),
left: event.pageX - offset.left - (closestHandle.width() / 2),
top: event.pageY - offset.top
- (closestHandle.height() / 2)
- (parseInt(closestHandle.css('borderTopWidth'),10) || 0)