hey Joel,

This is fun!

I think this should do it for the vertical stuff. You can apply something similar for the horizontal :

<snippet>
                                        var windowHeight = $w.height(),
                                                offsetTop = $u.offset().top,
                                                menuHeight = $u.height(),
                                                baseline = windowHeight + 
_offset('y'); // <-- ADDED
                                        var expandUp = (offsetTop + menuHeight > 
baseline); // <-- MODIFIED
                                        if (expandUp) {
$u.css('margin-top', baseline - (menuHeight + offsetTop)); // <-- MODIFIED
                                        }
</snippet>

extra parentheses in that last modified line not needed, of course. They just help me visualize what's going on.

Cheers,

--Karl

On Jan 31, 2008, at 10:13 AM, Joel Birch wrote:


Quick update,

I have done some more work on this code so now you can simply apply
the positioning plugin to Superfish like a regular plugin, which is
much easier for the user than how it was done before:

$(function() {
        $('.nav').superfish().supposition();
});

You could even apply it later on (although I'm not sure why you would):

$(function() {
        $('.nav').superfish();
        /* later that day... */
        $('.nav').supposition();
});

So as long as you attach Supposition after you have attached
Superfish, it works.

Thanks to Karl Swedberg's advice and code to get the correct page
offsets the positioning bug we have been pondering is partially fixed.
Notice on the main demo page where the menu is way down the page you
can actually see the submenus now so they are being positioned
properly. Thanks Karl.

However, all is not well. There are still situations when the submenus
are positioned too high. It seems to be when the window is constrained
to an area in the middle of a long document. See this screengrab for a
scenario where this happens:
http://users.tpg.com.au/j_birch/plugins/superfish/supposition-test/img/screengrab.png

The test page featured in that image is this page:
http://users.tpg.com.au/j_birch/plugins/superfish/supposition-test/menuAtTop.html

I think a similar problem would happen with the horizontal axis also.
Karl has suggested we look at the ClueTip code for further hints so
I'll do that next time I gather my meagre brain-power to have another
go at this.

The z-index bug is still untouched. If anyone wants to have a fiddle
with this stuff, here is a link to a Zip archive containing all the
test files, set up and ready to run locally.
http://users.tpg.com.au/j_birch/plugins/superfish/supposition-test.zip

Cheers
Joel Birch.


Reply via email to