Hey Joel,
That was a great post. I think you've done a great service to the
community in revealing some of the process involved in keeping your
plugin up to date and improving it. Thanks. Your commitment to making
Superfish an excellent, solid plugin is much appreciated.
I'm by no means a plugin wizard, and can't even take credit for the
callback option in clueTip (credit belongs to Dan G. Switzer), but if
you'd like to take a look at one approach, feel free. In the latest
revision (0.9.0), just look for "onShow." It'll be in the "defaults"
object with this line (line 130):
onShow: function (ct, c){},
then it'll be in the code right after the clueTip is shown (line 375):
// trigger the optional onShow function
defaults.onShow($cluetip, $cluetipInner);
Hope that helps.
--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Sep 15, 2007, at 3:47 AM, Joel Birch wrote:
Hi again,
So here's what happened. Between jQuery versions 1.1.2 and 1.1.3 the
animation engine was completely rewritten. Some of the behaviour that
Superfish was built upon was changed, such that show(), fadeIn() and
similar custom animations would no longer work unless the item was
first explicitly hidden (display:none). This meant I had to figure out
how to patch Superfish so that it worked with the stricter rules that
animations now demanded. The new animation engine is definitely
smoother and surely makes more sense in areas that I am ignorant of,
but the older one did seem more forgiving and foolproof to use. It
also allowed easier implementation of keyboard accessibility because
the hidden submenu ul elements could be positioned off-screen instead
of having to be display:none, allowing the contained links to be
focussed via the keyboard, and the "reveal" functions to be attached
to that focus event. These were the challenges I faced in updating
Superfish to work with the rapidly changing jQuery library.
By the time jQuery 1.1.4 came along I noticed that some of the
functionality (the keyboard access) was not working correctly, and
probably had not been since 1.1.3, so I once again dived in and fixed
that. It was after this latest re-juggling of the code that I noticed
that style="display:block;" was being retained after the submenus were
hidden. This caused the menu animation to not work the next time the
submenu was supposed to be shown due to reveal animations now needing
to be display:none to begin with. Being exhausted from all this code
patching I decided that there was nothing for it but to add the
removeAttr('style') callback, and have done with it. This made
Superfish finally behave very nearly as well as it did in jQuery 1.1.2
and below, which was very relieving.
After this, I continued to optimise how Superfish worked and explore
the implications of the recoding. Something I did at this stage is
likely to have made the need for the removeAttr to be unnecessary (I
have now thoroughly checked and confirmed this cross-browser), which
is great because it was an obvious, ugly hack. Thanks again, Jacob,
for discovering this fact.
Regarding your feature request for a callback function after the
animation has run, I think this should be easy to implement and would
be a nice option to have without adding much code. I'll look into the
best way of adding this callback. I haven't done this before but I'm
very interested in doing so. If I have any problems understanding how
to add callbacks to plugins I'll post a new thread to this list. Of
course, if anyone with this knowledge has read this far and wishes to
share it with me, I would hugely appreciate it ... :)
Joel Birch.
P.S. Thanks to everyone for the supportive feedback I have received -
it really helps keep my morale up when it comes to maintaining the
Superfish plugin.