결국 나는 답을 찾을 수 없으므로 스스로 해결할 수있었습니다. 나는이 blog post에서 그것을 설명하기 위해 노력했다
var winHeight = $(window).height();
$navULs = $('#nav ul');
$navULs.find('ul').each(function(i,v) {
$this = $(v);
var ulHeight = $this.height();
var parentHeight = $this.closest('li').height();
var parentTop = $this.offset().top;
var parentBottom = parentTop + parentHeight;
if ((winHeight - parentTop) < ulHeight) {
if (parentBottom < ulHeight) {
$this.css({
'margin-top': '0px', // remove margin-top (added by suckerfish css) as it screws up the calculations
'top': '-' + (parentTop) + 'px' // move the menu up by the amount of px available above the parent's top
});
} else {
$this.css('bottom', '0px'); // v basic, if sub menu will drop too much shove it up (css does the heavy lifting here)
}
}
});
:
다음은 내가 사용하는 코드는 (jQuery를 필요)입니다.