I have this fixed menu bar to the left of the page. But I would like the menu items to be hidden if the window is not tall enough to show all items at the same time.. The fixed menu bar has an overflow hidden to avoid scrollbars. My current script does it pretty well, but it will become way to long because I may have about 30 different menu items, which means that it would require many if/else statements to perform this. I execute this function every time the window is resized.
function resizeMenu() {
var win_h = $(window).height();
if (win_h < 220) {
$('div.list_item_btn').show().slice(1).hide();
$('.down_arrow').show();
} else if (win_h < 288) {
$('div.list_item_btn').show().slice(2).hide();
$('.down_arrow').show();
} else if (win_h < 356) {
$('div.list_item_btn').show().slice(3).hide();
$('.down_arrow').show();
} else {
$('div.list_item_btn').show()
}
}
Because every item-s height is 68px I have to continuously apply 68
to the umber increasing. I KNOW there is a better solution for this but here is the tricky thing.. if not all items are shown, I would like to show an arrow at the bottom. When clicked on this arrow I would like the menu items to slide up and hide 1 at the top showing 1 more at the bottom.
But I don't know how to slide content up as long as it is hidden.. it makes no sense and I kind of failed this one..