Modified the dump function, and fixed several places that needed to declare variables using var. Changed the pmgr.jquery.js file to jquery.hoverIntent.js. Fixed a bug causing no ordered lists, since padding and margin were set to 0 for all elements.
git-svn-id: file:///svn-source/pmgr/branches/pre_0.1_work_20090819@819 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
57
site/webroot/js/jquery.hoverIntent.js
Normal file
57
site/webroot/js/jquery.hoverIntent.js
Normal 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;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user