Changeset 5355
- Timestamp:
- 04/29/08 23:19:03 (7 months ago)
- Files:
-
- 1 modified
-
trunk/ui/ui.base.js (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ui/ui.base.js
r5174 r5355 61 61 }, 62 62 hasScroll: function(e, a) { 63 var scroll = /top/.test(a||"top") ? 'scrollTop' : 'scrollLeft', has = false;64 if (e[scroll] > 0) return true; e[scroll] = 1;65 has = e[scroll] > 0 ? true : false; e[scroll] = 0;66 return has; 67 }63 var scroll = /top/.test(a||"top") ? 'scrollTop' : 'scrollLeft', has = false; 64 if (e[scroll] > 0) return true; e[scroll] = 1; 65 has = e[scroll] > 0 ? true : false; e[scroll] = 0; 66 return has; 67 } 68 68 }); 69 69 70 70 /******* fn scope modifications ********/ 71 71 72 $.each( ['Left', 'Top'], function(i, name) {73 if(!$.fn['scroll'+name]) $.fn['scroll'+name] = function(v) {74 return v != undefined ?75 this.each(function() { this == window || this == document ? window.scrollTo(name == 'Left' ? v : $(window)['scrollLeft'](), name == 'Top' ? v : $(window)['scrollTop']()) : this['scroll'+name] = v; }) :76 this[0] == window || this[0] == document ? self[(name == 'Left' ? 'pageXOffset' : 'pageYOffset')] || $.boxModel && document.documentElement['scroll'+name] || document.body['scroll'+name] : this[0][ 'scroll' + name ];77 };78 });79 80 72 var _remove = $.fn.remove; 81 73 $.fn.extend({ 82 position: function() {83 var offset = this.offset();84 var offsetParent = this.offsetParent();85 var parentOffset = offsetParent.offset();86 87 return {88 top: offset.top - num(this[0], 'marginTop') - parentOffset.top - num(offsetParent, 'borderTopWidth'),89 left: offset.left - num(this[0], 'marginLeft') - parentOffset.left - num(offsetParent, 'borderLeftWidth')90 };91 },92 offsetParent: function() {93 var offsetParent = this[0].offsetParent;94 while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && $.css(offsetParent, 'position') == 'static') )95 offsetParent = offsetParent.offsetParent;96 return $(offsetParent);97 },98 74 mouseInteraction: function(o) { 99 75 return this.each(function() { … … 112 88 } 113 89 }); 114 115 function num(el, prop) {116 return parseInt($.curCSS(el.jquery?el[0]:el,prop,true))||0;117 };118 90 119 91 … … 148 120 || (this.options.condition && !this.options.condition.apply(this.options.executor || this, [e, this.element])) //Prevent execution on condition 149 121 ) return true; 150 122 151 123 var self = this; 152 124 var initialize = function() { … … 155 127 $(document).bind('mousemove.draggable', function() { return self.drag.apply(self, arguments); }); 156 128 157 if(!self.initalized && Math.abs(self._MP.left-e.pageX) >= self.options.distance || Math.abs(self._MP.top-e.pageY) >= self.options.distance) { 129 if(!self.initalized && Math.abs(self._MP.left-e.pageX) >= self.options.distance || Math.abs(self._MP.top-e.pageY) >= self.options.distance) { 158 130 if(self.options.start) self.options.start.call(self.options.executor || self, e, self.element); 159 131 if(self.options.drag) self.options.drag.call(self.options.executor || self, e, this.element); //This is actually not correct, but expected … … 172 144 173 145 }, 174 stop: function(e) { 146 stop: function(e) { 175 147 176 148 var o = this.options; … … 188 160 if ($.browser.msie && !e.button) return this.stop.apply(this, [e]); // IE mouseup check 189 161 190 if(!this.initialized && (Math.abs(this._MP.left-e.pageX) >= o.distance || Math.abs(this._MP.top-e.pageY) >= o.distance)) { 162 if(!this.initialized && (Math.abs(this._MP.left-e.pageX) >= o.distance || Math.abs(this._MP.top-e.pageY) >= o.distance)) { 191 163 if(this.options.start) this.options.start.call(this.options.executor || this, e, this.element); 192 164 this.initialized = true;
