[Jifty-commit] r1540 - in jifty/trunk: share/web/static/js
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Wed Jul 12 01:38:43 EDT 2006
Author: trs
Date: Wed Jul 12 01:38:42 2006
New Revision: 1540
Modified:
jifty/trunk/ (props changed)
jifty/trunk/share/web/static/js/calendar.js
jifty/trunk/share/web/static/js/jifty_utils.js
Log:
r14182 at zot: tom | 2006-07-12 01:38:27 -0400
Fix calendar positioning bug and make sure it works when the date field is within a relative or absolutely positioned element
Modified: jifty/trunk/share/web/static/js/calendar.js
==============================================================================
--- jifty/trunk/share/web/static/js/calendar.js (original)
+++ jifty/trunk/share/web/static/js/calendar.js Wed Jul 12 01:38:42 2006
@@ -40,8 +40,8 @@
wrap.setAttribute( "id", wrapId );
wrap.style.position = "absolute";
- wrap.style.left = Jifty.Utils.findPosX( input );
- wrap.style.top = Jifty.Utils.findPosY( input ) + input.offsetHeight;
+ wrap.style.left = Jifty.Utils.findRelativePosX( input ) + "px";
+ wrap.style.top = Jifty.Utils.findRelativePosY( input ) + input.offsetHeight + "px";
input.parentNode.insertBefore( wrap, input.nextSibling );
@@ -72,7 +72,7 @@
openCalendar: "",
hideOpenCalendar: function() {
- if ( Jifty.Calendar.openCalendar ) {
+ if ( Jifty.Calendar.openCalendar && $( Jifty.Calendar.openCalendar ) ) {
$( Jifty.Calendar.openCalendar ).style.display = "none";
/* Get the input's ID */
Modified: jifty/trunk/share/web/static/js/jifty_utils.js
==============================================================================
--- jifty/trunk/share/web/static/js/jifty_utils.js (original)
+++ jifty/trunk/share/web/static/js/jifty_utils.js Wed Jul 12 01:38:42 2006
@@ -35,6 +35,42 @@
return curtop;
},
+ findRelativePosX: function(e) {
+ var parent = e.parentNode;
+ var parentx = 0;
+
+ while ( parent ) {
+ if ( !parent.style ) break;
+
+ var pos = Element.getStyle( parent, "position" );
+ if ( pos == "relative" || pos == "absolute" ) {
+ parentx = Jifty.Utils.findPosX( parent );
+ break;
+ }
+ parent = parent.parentNode;
+ }
+
+ return Jifty.Utils.findPosX( e ) - parentx;
+ },
+
+ findRelativePosY: function(e) {
+ var parent = e.parentNode;
+ var parenty = 0;
+
+ while ( parent ) {
+ if ( !parent.style ) break;
+
+ var pos = Element.getStyle( parent, "position" );
+ if ( pos == "relative" || pos == "absolute" ) {
+ parenty = Jifty.Utils.findPosY( parent );
+ break;
+ }
+ parent = parent.parentNode;
+ }
+
+ return Jifty.Utils.findPosY( e ) - parenty;
+ },
+
isMSIE: false,
findScreenHeight: function() {
More information about the Jifty-commit
mailing list