Fixed problems with the sizing of the sidemenu, as well as the animation problem (an issue caused by the lack of clear parent container sizing, since the parent was just a table cell). This is actually much cleaner, allowing us to ignore #sidecolumn in the sidemenu.css file, and simplifies jQuery accordion work as well (thus no jitter). Added a mechanism to dump javascript in a consistent place, when generated from elements included by the layout (namely, our sidemenu element). Finally, added a new event called hoverintent, since the mouseover feature works very poorly with the accordion module when animation is in use.

git-svn-id: file:///svn-source/pmgr/branches/pre_0.1_work_20090819@774 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-08-25 01:24:23 +00:00
parent 56bec8d05c
commit c3ad1b0ea1
5 changed files with 99 additions and 19 deletions

View File

@@ -15,6 +15,7 @@ table#layout { width: 100% }
td#sidecolumn ,
td#pagecolumn { vertical-align: top; }
td#pagecolumn { padding-left: 4mm; }
td#sidecolumn { width: 1% }
/************************************************************

View File

@@ -3,8 +3,7 @@
* Side Menu Layout
*/
td#sidecolumn { width: 12em; text-align: left; }
#sidemenu { height: 20em; }
#sidemenu-container { width: 12em; height: 20em; }
/************************************************************

View File

@@ -0,0 +1,57 @@
/* ******************************************************************************
* hoverintent
*
* Works like mouseover, but instead of firing immediately when an object
* is mouseover'ed, it tries to determine when the user actually _intends_
* to have the pointer hover over the object. In other words, it's a lot
* like mouseover with a delay before firing, and if the pointer moves
* before hoverintent can fire, it doesn't fire at all.
*
* Found from jQuery UI Ticket #3614
* http://dev.jqueryui.com/ticket/3614
*/
var cfg = ($.hoverintent = {
sensitivity: 7,
interval: 100
});
$.event.special.hoverintent = {
setup: function() {
$(this).bind("mouseover", jQuery.event.special.hoverintent.handler);
},
teardown: function() {
$(this).unbind("mouseover", jQuery.event.special.hoverintent.handler);
},
handler: function(event) {
event.type = "hoverintent";
var self = this,
args = arguments,
target = $(event.target),
cX, cY, pX, pY;
function track(event) {
cX = event.pageX;
cY = event.pageY;
};
pX = event.pageX;
pY = event.pageY;
function clear() {
target.unbind("mousemove", track).unbind("mouseout", arguments.callee);
clearTimeout(timeout);
}
function handler() {
if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
clear();
jQuery.event.handle.apply(self, args);
} else {
pX = cX; pY = cY;
timeout = setTimeout(handler, cfg.interval);
}
}
var timeout = setTimeout(handler, cfg.interval);
target.mousemove(track).mouseout(clear);
return true;
}
};