var p = [e.pageX,e.pageY], o = this.options, c, distance = 1;\r
this.current = this.items[0];\r
\r
- //Compute the parents distance, because we don't need to fire anything if we are not near the parent\r
- var overlap = ((p[0] > this.pp.left-o.distance && p[0] < this.pp.left + this.element[0].offsetWidth + o.distance) && (p[1] > this.pp.top-o.distance && p[1] < this.pp.top + this.element[0].offsetHeight + o.distance));\r
+ // Compute the parent's distance\r
+ // we don't need to fire anything if we are not near the parent\r
+ var overlap = ((p[0] > this.pp.left-o.distance) &&\r
+ (p[0] < this.pp.left + this.element[0].offsetWidth + o.distance) &&\r
+ (p[1] > this.pp.top-o.distance) &&\r
+ (p[1] < this.pp.top + this.element[0].offsetHeight + o.distance));\r
if (!overlap) { return false; }\r
\r
for (var i=0; i<this.items.length; i++) {\r
c = this.items[i];\r
\r
var olddistance = distance;\r
- if(!o.axis) {\r
+ if (!o.axis) {\r
distance = Math.sqrt(\r
Math.pow(p[0] - ((c[3] ? this.pp.left : c[1].left) + parseInt(c[0].style.left,10)) - (c[0].offsetWidth/2), 2)\r
+ Math.pow(p[1] - ((c[3] ? this.pp.top : c[1].top ) + parseInt(c[0].style.top,10)) - (c[0].offsetHeight/2), 2)\r
distance = Math.abs(p[1] - ((c[3] ? this.pp.top : c[1].top ) + parseInt(c[0].style.top,10)) - (c[0].offsetHeight/2));\r
} else {\r
distance = Math.abs(p[0] - ((c[3] ? this.pp.left : c[1].left) + parseInt(c[0].style.left,10)) - (c[0].offsetWidth/2));\r
- } \r
+ }\r
}\r
\r
if (distance < o.distance) {\r
- this.current = distance < olddistance ? this.items[i] : this.current;\r
+ this.current = distance < olddistance ? c : this.current;\r
\r
if (!o.axis || o.axis != "y") {\r
$(c[0]).css({\r
$(c[0]).css({\r
height: c[2][1]+ (c[2][1] * (o.magnification-1)) - (((distance/o.distance)*c[2][1]) * (o.magnification-1)),\r
top: (c[3] ? c[3].top : 0) + (o.baseline-0.5) * ((c[2][0] * (o.magnification-1)) - (((distance/o.distance)*c[2][0]) * (o.magnification-1)))\r
- }); \r
+ });\r
}\r
\r
if (o.opacity) {\r
(o.zIndex && $(c[0]).css("z-index", ""));\r
}\r
\r
- (this.options.zIndex &&\r
- $(this.current[0]).css("z-index", this.options.zIndex));\r
- } \r
+ (o.zIndex && $(this.current[0]).css("z-index", o.zIndex));\r
+ }\r
});\r
\r
$.extend($.ui.magnifier, {\r