Joel,

Good work, it seems to function as intended. Unfortunately, I can't
really use it for my purposes. You implemented it exactly as I had
requested, but what that translates into for my code is the shifting
of the drop-down's left position occurs after the animation to reveal
it is complete. I think you have it where it should be and where it
will probably be most useful - it's just not the solution I need (nor
do I think I need superfish to handle my problem).

With your new functionality my code looks like this:

$('.sfMenuDropDown').superfish({
        animation : {height: 'show'},
        onshow: function() {
                $(this).css({left: $(this).parent().offset().left}).bgiframe();
        }
});
(the bgiframe call should probably be moved, but I didn't bother with
it for my testing)

While the code I had previously (and will continue using) looks like:

$('.sfMenuDropDown')
        .superfish({animation : {height: 'show'}})
        .mouseover(function() {
                $('ul', this).css({left: $(this).offset().left}).bgiframe();
        });

So, as you can see, it's not really all that bad, to use what I have.
I guess if you wanted to add more functionality to Superfish, you
could add other hooks so there would be a hook before the show
animation, after it's shown (currently where you have it), before
hiding and after it's hidden. However, the complexity and possible
bloat probably aren't worth it. I think the one function call after
revealing is sufficient.

One thing I wasn't able to test was how well the function call works
with nested menus (my implementation only has a single level drop
down).

Thanks again for all your help and work.
Jacob Stuart

On Sep 17, 11:19 am, "Joel Birch" <[EMAIL PROTECTED]> wrote:
> Thanks Jacob.
>
> I wondered if you would be interested in checking out my initial
> attempt at adding the callback function feature. A beta version of the
> new JS file is 
> here:http://users.tpg.com.au/j_birch/plugins/superfish/superfish-1.3.2b.js
>
> That file should work with whatever example you have at hand if any
> (no pressure to test this). To test the callback function you could
> use the options object like this for example:
>
> $('#myNav').superfish({
>     onshow: function(){
>         $(this).css('border','solid 1px red')};
>     }
>
> });
>
> If you use the 'this' keyword in the onshow function you pass in, it
> will refer to the ul element that was just revealed.
>
> Is this the sort of thing you had in mind? Can anyone see a problem
> with how I have done this? All I did was add o.onshow.call(this)
> inside the callback of the animation that shows the submenu, so that
> onshow is called in the scope of the revealed ul. Seems worryingly
> simple - I was sure there would be more to it than this....
>
> Joel Birch.

Reply via email to