cool - i got it working (below). it opens "upward" only if its near the bottom of the list (or quite large)
i didn't want it opening above the top of the page either.
any kind suggestions are appreciated!
$(document).ready(function(){
$("ul.sf-menu").superfish({
delay: 1000,
onBeforeShow: function() {
thisHeight = $(this).height();
//parentTop = this.parent().offset().top;
if ( thisHeight > 0 ) {
thisParent = this.parent();
parentTop = thisParent.offset().top;
parentHeight = this.parent().height();
parentBottom = parentHeight + parentTop ;
mainTop = document.getElementsByClassName('sf-menu')[0].offsetTop ;
mainBottom = document.getElementsByClassName('sf-menu')[0].offsetHeight ;
if ( ( thisHeight + parentTop ) > ( mainTop + mainBottom ) ) {
// do we open below the bottom of the main list ?
if ( thisHeight > ( parentTop + parentHeight ) ) {
// do we open ABOVE the top ?
$(this).css('top', - (parentTop - mainTop));
} else {
// open upward
$(this).css('top', - (thisHeight - parentHeight) );
}
}
}
}
});
});