Opened 15 years ago
Closed 13 years ago
#2895 closed bug (invalid)
function coord(el,prop) in JQuerySpinBtn.js not work properly in IE
Reported by: | Aray | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.2.4 |
Component: | plugin | Version: | 1.2.3 |
Keywords: | spin button | Cc: | [email protected]… |
Blocked by: | Blocking: |
Description
The plugin Spin Button is greate, It is very usefull to me. Thank you for your greate work.
But there were a little problem in JQuerySpinBtn.js, wich I download from http://www.softwareunity.com/sandbox/jqueryspinbtn/JQuerySpinBtn.js.
the function coord(el,prop) not work properly in IE if document.body's padding or margin is not ZERO.
Following is the offcial release of code
function coord(el,prop) {
var c = el[prop], b = document.body;
while ((el = el.offsetParent) && (el != b)) {
if (!$.browser.msie (el.currentStyle.position != 'relative')) c += el[prop];
}
return c;
}
Maybe it should be change to like following:
function coord(el,prop) {
var c = el[prop], b = document.body;
while ((el = el.offsetParent) /*&& (el != b)*/) {
if (!$.browser.msie (el.currentStyle.position != 'relative')) c += el[prop];
} if(el == b)
break;
return c;
}
The attachment SpinButton.zip contain two demon to show the problem, their files are all the same, except JQuerySpinBtn.js
Attachments (1)
Change History (4)
Changed 15 years ago by
Attachment: | SpinButton.zip added |
---|
comment:1 Changed 15 years ago by
comment:2 Changed 15 years ago by
I found another problem when using IE. if the IE window have a scroll bar, and the scroll bar are note in Top or in Left position. It will not work properly
The reason is that, In IE, the Event.y is the distance of document top to mouse point, this distance is NOT including the scroll bar position. so does the Event.x.
e.y;" in JQuerySpinBtn.js, add following code below this line |
if($.browser.msie) {
x += document.documentElement.scrollLeft;
y += document.documentElement.scrollTop;
}
I don't have enough knowledge of compatibility of JavaScript between IE,Firefox, blabla. The code may make some change.
comment:4 Changed 13 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
This is not a jQuery core bug. Please report plugin bugs to the plugin's author, or ask on the jQuery forums. jQuery UI bugs should be reported on the UI bug tracker, http://dev.jqueryui.com .
Replying to Aray:
I am so sorry that I have made a mistake, to fix the problem, the correct code should be as following.