jquery Programming Glossary: mindistance
Find html element nearest to position (relative or absolute) http://stackoverflow.com/questions/2337630/find-html-element-nearest-to-position-relative-or-absolute within the collection closestToOffset function offset var el null elOffset x offset.left y offset.top distance dx dy minDistance this.each function elOffset this .offset if x elOffset.left x elOffset.right y elOffset.top y elOffset.bottom el this return.. elOffset.bottom for off in offsets dx offsets off 0 x dy offsets off 1 y distance Math.sqrt dx dx dy dy if minDistance undefined distance minDistance minDistance distance el this return el Few notes If the offset is inside one of the elements.. in offsets dx offsets off 0 x dy offsets off 1 y distance Math.sqrt dx dx dy dy if minDistance undefined distance minDistance minDistance distance el this return el Few notes If the offset is inside one of the elements it will be returned. I'm..
jquery ui drag easing/inertia http://stackoverflow.com/questions/4443526/jquery-ui-drag-easing-inertia outside it's parent container's boundaries The resulting code function var d #draggable var x1 x2 y1 y2 t1 t2 Time var minDistance 40 Minimum px distance object must be dragged to enable momentum. var onMouseMove function e var mouseEvents d.data mouseEvents.. dY dMs 1 1 Distance moved Euclidean distance var distance Math.sqrt Math.pow x1 x2 2 Math.pow y1 y2 2 if distance minDistance Momentum var lastStepTime new Date d.animate textIndent 0 duration Math.max Math.abs speedX Math.abs speedY 2000 step..
|