When using a trigger of 'now' on beautytips, I found that the bubble was not painted and the firebug console showed the error "this.btOn() is not a function". I was able to reproduce this by invoking the beautytips jquery plugin directly from Javascript as well as through the Drupal module so this appears to be an issue with the plugin rather than the Drupal module code. However, since there seems to be little activity at the plugin's issue queue, and since I've seen other plugin issues mentioned here, I'm reporting this so others can be aware.
My aim is to display additional help bubbles next to some form fields when there has been a validation error. The bubble should be painted immediately next to the field in question and remain there regardless of any other clicks or tips appearing.
On stepping through the code, it seems that when the 'now' trigger is used, the btOn() call is made before the btOn() function has been declared for this object, hence the error message. Moving the relevant code to after the declarations now has it working for me.
This then highlighted a second issue in these circumstance. Beautytips goes to some effort to make sure bubbles are visible within the current scroll window, which usually makes sense. However, when a static bubble is being painted to be next to a field which may be outside the current scroll window, it is better if these visibility checks are skipped. A couple of simple changes added a new 'noScroll' options which bypasses the more sophisticated positioning.
The 'now' trigger does it's stuff now, using the following options:
'trigger' => array('now'),
'clickAnywhereToClose' => FALSE,
'closeWhenOthersOpen' => FALSE,
'preEval' => TRUE,
'noScroll' => TRUE,
...
If is of use to anyone, a patch is attached for these changes.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | jquerybtjs.zip | 13.71 KB | stevehuk |
| beautytips-trigger-now-01.patch | 6.51 KB | stevehuk |
Comments
Comment #1
kleinmp commentedThanks for the patch. Since it is being applied to the jquery plugin, it would be better to post it as an issue here. However, since the site was archived, I'm not entirely clear on what is happening with the plugins as far as maintenance, so we can postpone this for now.
Comment #2
davejuk commentedI'm having trouble with the now trigger in BeautyTips too but I'm struggling to apply the patch. I have downloaded a couple of different patch utilities for Windows from Source Forge but they hang when I run them from the command line. I suspect it is because I am running Windows 7 x64. Can you post the patched file, or tell me where I can a 64 bit compatible Windows patch utility? Thanks
Comment #3
stevehuk commentedHere's my version of the patched file. It will have to be saved with the correct file name: jquery.bt.js
Comment #4
stevehuk commented.. and this time with the attachment as a zip file.
Comment #5
pifagor