This is very useful when using BoxOver on input fields. Forget "?" marks next to form fields, use the field itself.
The one thing I needed for this was way to stop the box from appearing when the user mouses over the form field if they are going to type something or use a dropdown, etc.
Enter the "clickoff" parameter. As soon as the user clicks on the form field, the box is prevented from appearing (if there's a delay) or turned off if it's already on. Combined with a short delay, using clickoff means advanced users never need to see the tooltip, yet novice users can hover to see it. As soon as they click in the field, it goes away.
Changes are easy. First, replace the following block of code in
function scanBO(curNode) with this:
Code:
if (getParam('requireclick',curNode.title)=='on') {
curNode.requireclick=true;
document.all?curNode.attachEvent('onclick',showHideBox):curNode.addEventListener('click',showHideBox,false);
document.all?curNode.attachEvent('onmouseover',hideBox):curNode.addEventListener('mouseover',hideBox,false);
}
else // Note : if requireclick is on the stop clicks are ignored
{
if (getParam('clickoff',curNode.title)=='on') { //[AH] enable the clickoff function.
document.all?curNode.attachEvent('onmousedown',clickOff):curNode.addEventListener('mousedown',clickOff,false);
}
else //[AH] If clickOff is on the stop clicks are ignored also.
{
if (getParam('doubleclickstop',curNode.title)!='off') {
document.all?curNode.attachEvent('ondblclick',pauseBox):curNode.addEventListener('dblclick',pauseBox,false);
}
if (getParam('singleclickstop',curNode.title)=='on') {
document.all?curNode.attachEvent('onclick',pauseBox):curNode.addEventListener('click',pauseBox,false);
}
}
}
The only other change is to add the
clickOff(e) function anywhere you like:
Code:
//[AH] stop box from appearing if there's a delay, and/or turn it off.
function clickOff(e) {
if(ID!=null) { clearTimeout(ID); ID=null; }
hideBox(e);
}
That's it. Now you can put "clickoff=[on]" in your parameter list to use it.