]> source.dussan.org Git - jquery-ui.git/commitdiff
Fixed 4062 - slider: vertical slider handle jumps up when you click on it
authorRichard Worth <rdworth@gmail.com>
Thu, 5 Feb 2009 06:01:10 +0000 (06:01 +0000)
committerRichard Worth <rdworth@gmail.com>
Thu, 5 Feb 2009 06:01:10 +0000 (06:01 +0000)
ui/ui.slider.js

index f96767b4913601c616c7cfa136604c9611ed7acb..b1d4af1a18cb7e5a4bb4b8bb6b9360ac25cb9fff 100644 (file)
@@ -214,7 +214,11 @@ $.widget("ui.slider", $.extend({}, $.ui.mouse, {
                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),
-                       top: event.pageY - offset.top + (parseInt(closestHandle.css('marginTop'),10) || 0)
+                       top: event.pageY - offset.top
+                               - (closestHandle.height() / 2)
+                               - (parseInt(closestHandle.css('borderTopWidth'),10) || 0)
+                               - (parseInt(closestHandle.css('borderBottomWidth'),10) || 0)
+                               + (parseInt(closestHandle.css('marginTop'),10) || 0)
                };
 
                normValue = this._normValueFromMouse(position);