offCanvasMenu icon indicating copy to clipboard operation
offCanvasMenu copied to clipboard

Menu contents get cut off when content is shorter than menu

Open FlorianElischer opened this issue 11 years ago • 12 comments

If there are just a few links, everything works fine. But if there would be a long list of links, I can't scroll down to the bottom of them due to no available height for the ul in the #menu div.

FlorianElischer avatar Jul 22 '13 14:07 FlorianElischer

Hmm, that's not good. The plugin should be setting the outer wrapper height based on the tallest element (body content or menu).

Is the menu content taller than the page content? — Sent from Mailbox for iPad

On Mon, Jul 22, 2013 at 7:04 AM, FlorianElischer [email protected] wrote:

If there are just a few links, everything works fine. But if there would be a long list of links, I can't scroll down to the bottom of them due to no available height for the ul in the #menu div.

Reply to this email directly or view it on GitHub: https://github.com/cloudfour/offCanvasMenu/issues/17

tylersticka avatar Jul 22 '13 17:07 tylersticka

I tested it again. Once with more content, once with more links to get different heights to compare. Only if the content area is higher than the link area, all links are visible. If not they got cut. Would be cool if you could fix this problem. Thx!

FlorianElischer avatar Jul 23 '13 07:07 FlorianElischer

Thanks for clarifying! I've marked this as a bug and modified the issue title to reflect what needs to be fixed.

I actually saw this myself on a project a while back, but it seemed to remedy itself and I thought I was going crazy. Good to know I wasn't! I'll look into a fix soon.

In the meantime, if you're getting something ready for production and you can't wait for a fix, a stop-gap solution would be to give your content container a min-height that's about as large as you expect the menu contents to be. You can apply this selectively by using the off-canvas-menu class:

.off-canvas-menu .my-content-container {
  min-height: 400px; /* or whatever it should be */
}

I'll update this issue when I've committed a fix.

tylersticka avatar Jul 23 '13 15:07 tylersticka

@FlorianElischer Hmm, that seemed almost too easy to resolve. Would you mind trying out the latest build and confirming whether or not it resolves the issue?

tylersticka avatar Jul 23 '13 16:07 tylersticka

It's working now :) Thanks!

FlorianElischer avatar Jul 24 '13 10:07 FlorianElischer

Wonderful! :+1:

tylersticka avatar Jul 25 '13 16:07 tylersticka

This fix has been reverted. See https://github.com/cloudfour/offCanvasMenu/issues/19 We need to revisit this and come up with a solution that does not cause a FOUC.

mattpage avatar Aug 19 '13 18:08 mattpage

The menu currently gets a flashy cut off for about 1/10 second whenever activated on iOS browsers, due to inner-wrapper height changed from 0px to max height. I temporarily fixed it in my projects by specifying min-height for .inner-wrapper at plugin init to prevent the cut off flash. Suggest not to change inner-wrapper height when activate/deactivate menu?

sieumeo avatar Aug 24 '13 12:08 sieumeo

@sieumeo What did you set min-height to?

Would you be comfortable forking the repo and submitting a pull request (assuming your changes were made to the Coffeescript source file)?

tylersticka avatar Aug 26 '13 16:08 tylersticka

No I didn't modify the plugin but added a new CSS rule for inner-wrapper right after menu.on();

menu.on();
$(".inner-wrapper").css("min-height",Math.max($(window).height(), $(document).height(), $("body").prop('scrollHeight'))); // fix menu glitch

UPDATE: For some projects with fixed menu, I simply added a fixed min-height directly to the CSS file.

sieumeo avatar Aug 27 '13 04:08 sieumeo

The drawback with that solution is that if the height changes (maybe additional images load, maybe the content is dynamic, maybe a web font hadn't loaded yet, etc.) the height may be out of date.

Will look into it, thanks for the additional detail. The current setHeight/clearHeight logic was created to make the plugin more compatible with Internet Explorer, which was having some issues with reported heights. Potentially we could make this a setting of some sort...

tylersticka avatar Aug 27 '13 16:08 tylersticka

Maybe a test to see if the browser is IE at plugin init, then we'll only clearHeight later if it is?

Thanks and Best Regards, Phan Tuan Anh

On Tue, Aug 27, 2013 at 11:20 PM, Tyler Sticka [email protected]:

The drawback with that solution is that if the height changes (maybe additional images load, maybe the content is dynamic, maybe a web font hadn't loaded yet, etc.) the height may be out of date.

Will look into it, thanks for the additional detail. The current setHeight/clearHeight logic was created to make the plugin more compatible with Internet Explorer, which was having some issues with reported heights. Potentially we could make this a setting of some sort...

— Reply to this email directly or view it on GitHubhttps://github.com/cloudfour/offCanvasMenu/issues/17#issuecomment-23349756 .

sieumeo avatar Aug 27 '13 16:08 sieumeo