mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Magnifier: Partial cleanup.
This commit is contained in:
parent
c2ce22addf
commit
6cfb6208ee
@ -99,8 +99,12 @@ $.widget("ui.magnifier", {
|
||||
var p = [e.pageX,e.pageY], o = this.options, c, distance = 1;
|
||||
this.current = this.items[0];
|
||||
|
||||
//Compute the parents distance, because we don't need to fire anything if we are not near the parent
|
||||
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));
|
||||
// Compute the parent's distance
|
||||
// we don't need to fire anything if we are not near the parent
|
||||
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));
|
||||
if (!overlap) { return false; }
|
||||
|
||||
for (var i=0; i<this.items.length; i++) {
|
||||
@ -121,7 +125,7 @@ $.widget("ui.magnifier", {
|
||||
}
|
||||
|
||||
if (distance < o.distance) {
|
||||
this.current = distance < olddistance ? this.items[i] : this.current;
|
||||
this.current = distance < olddistance ? c : this.current;
|
||||
|
||||
if (!o.axis || o.axis != "y") {
|
||||
$(c[0]).css({
|
||||
@ -154,8 +158,7 @@ $.widget("ui.magnifier", {
|
||||
(o.zIndex && $(c[0]).css("z-index", ""));
|
||||
}
|
||||
|
||||
(this.options.zIndex &&
|
||||
$(this.current[0]).css("z-index", this.options.zIndex));
|
||||
(o.zIndex && $(this.current[0]).css("z-index", o.zIndex));
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user