pollyplummer
Total Posts: 71
Joined: 2009-01-19
Tulsa, OK
Instead of using the date selector in custom options for products, I changed the settings so that it pops up the calendar. Everything works fine in Firefox and Safari. However, IE pops the calendar much further up the page from the box where it belongs. Has anyone else done a CSS hack for IE to fix this? Is the positioning in the JS? Any hints would help
Posted: August 4 2009
| top
pollyplummer
Total Posts: 71
Joined: 2009-01-19
Tulsa, OK
Any JavaScript experts know what I need to alter here to make the calendar pop up next to the box in IE?
/* * Different ways to find element's absolute position */Calendar . getAbsolutePos = function( element ) { var res = new Object (); res . x = 0 ; res . y = 0 ; // variant 1 (working best, copy-paste from prototype library) do { res . x += element . offsetLeft || 0 ; res . y += element . offsetTop || 0 ; element = element . offsetParent ; if ( element ) { if ( element . tagName . toUpperCase () == 'BODY' ) break; var p = Calendar . getStyle ( element , 'position' ); if ( p !== 'static' ) break; } } while ( element ); return res ; // variant 2 (good solution, but lost in IE8) if ( element !== null ) { res . x = element . offsetLeft ; res . y = element . offsetTop ; var offsetParent = element . offsetParent ; var parentNode = element . parentNode ; while ( offsetParent !== null ) { res . x += offsetParent . offsetLeft ; res . y += offsetParent . offsetTop ; if ( offsetParent != document . body && offsetParent != document . documentElement ) { res . x -= offsetParent . scrollLeft ; res . y -= offsetParent . scrollTop ; } //next lines are necessary to support FireFox problem with offsetParent if ( Calendar . is_gecko ) { while ( offsetParent != parentNode && parentNode !== null ) { res . x -= parentNode . scrollLeft ; res . y -= parentNode . scrollTop ; parentNode = parentNode . parentNode ; } } parentNode = offsetParent . parentNode ; offsetParent = offsetParent . offsetParent ; } } return res ; // variant 2 (not working) // var SL = 0, ST = 0; // var is_div = /^div$/i.test(el.tagName); // if (is_div && el.scrollLeft) // SL = el.scrollLeft; // if (is_div && el.scrollTop) // ST = el.scrollTop; // var r = { x: el.offsetLeft - SL, y: el.offsetTop - ST }; // if (el.offsetParent) { // var tmp = this.getAbsolutePos(el.offsetParent); // r.x += tmp.x; // r.y += tmp.y; // } // return r; } ;
Posted: August 5 2009
| top
| # 1
Carl_Malone
Total Posts: 5
Joined: 2009-06-04
Hi,
nice to see I am not alone with this problem. I solved it this way:
In Calendar.js, around line 1459:
if ( Calendar . is_ie ) { /* old non working br.y += document.body.scrollTop; br.x += document.body.scrollLeft; */ br . y += document . body . document . documentElement . scrollTop ; br . x += document . body . document . documentElement . scrollLeft ;
Need to test it in older IE versions before 100% sure that it works.
Posted: October 1 2009
| top
| # 2
thaddeusmt
Total Posts: 31
Joined: 2009-02-02
Bozeman, MT
Thanks, Carl_Malone!!
Works like a charm, as far as I can tell.
I really needed this too, since the client needed Cal popups in the backend and refuses to use Firefox.
Signature
---------------------------------------------------
http://www.chilipepperdesign.com
Posted: October 1 2009
| top
| # 3
webshop discounter
Total Posts: 227
Joined: 2008-09-23
Thanks, Carl_Malone!!
I was looking for this a long time!!
Posted: October 2 2009
| top
| # 4
Vijay_TDS
Total Posts: 3
Joined: 2009-11-06
Thank you...Its magic really working in IE 8
Posted: November 6 2009
| top
| # 5