var self = this,\r
o = this.options;\r
\r
- this.element.addClass("ui-magnifier");\r
+ this.element\r
+ .addClass("ui-magnifier")\r
+ .bind('click.magnifier', function(e) {\r
+ (!self.disabled && o.click && o.click.apply(this, [e, {\r
+ options: self.options,\r
+ current: self.current[0],\r
+ currentOffset: self.current[1]\r
+ }]));\r
+ });\r
+ \r
+ // the element must have relative or absolute positioning\r
if (!(/^(r|a)/).test(this.element.css("position"))) {\r
this.element.css("position", "relative");\r
}\r
\r
- this.pp = this.element.offset();\r
- \r
this.items = [];\r
this.element.find(o.items).each(function() {\r
var $this = $(this);\r
(o.opacity && $this.css('opacity', o.opacity.min));\r
});\r
\r
- if (o.overlap) {\r
- for (var i=0; i<this.items.length; i++) {\r
- //Absolutize\r
- $(this.items[i][0]).css({\r
- position: "absolute",\r
- top: this.items[i][3].top,\r
- left: this.items[i][3].left\r
- });\r
- }\r
- }\r
+ // absolutize\r
+ (o.overlap && $.each(this.items, function() {\r
+ $(this[0]).css({\r
+ position: "absolute",\r
+ top: this[3].top,\r
+ left: this[3].left\r
+ });\r
+ }));\r
\r
this.identifier = ++counter;\r
$(document).bind("mousemove.magnifier"+this.identifier, function(e) {\r
(self.disabled || self.magnify.apply(self, [e]));\r
});\r
\r
- if (o.click) {\r
- this.element.bind('click.magnifier', function(e) {\r
- if (!self.disabled) {\r
- o.click.apply(this, [e, {\r
- options: self.options,\r
- current: self.current[0],\r
- currentOffset: self.current[1]\r
- }]);\r
- }\r
- });\r
- }\r
+ this.pp = this.element.offset();\r
},\r
\r
destroy: function() {\r