thomaspark / bootswatch

Themes for Bootstrap
https://bootswatch.com
MIT License
14.57k stars 3.67k forks source link

Add support for off canvas menu toggle #1301

Open 2dareis2do opened 6 months ago

2dareis2do commented 6 months ago

On Bootstrap the fly out menu seems to be the default, at least on the get-bootstrap site.

From what I can tell all the demos for bootswatch use a dropdown menu. Is it possible to also add support for off canvas style menu as well? From what I can tell the funtionality os easily added but the colour scheme appear to be off. An example of this is with the Sketchy theme.

Screenshot 2024-04-16 at 21 33 27 Screenshot 2024-04-16 at 21 36 00 Screenshot 2024-04-16 at 21 36 11 Screenshot 2024-04-16 at 21 38 40
2dareis2do commented 6 months ago

Looking in a bit more detail, it appears some additional styles are required for this. e.g. get-boostrap uses https://github.com/twbs/bootstrap/blob/ad0cc68b7e226d9e1c1feb39ca68c0404c304365/site/assets/scss/_navbar.scss#L2

These seems to be site specific settings the main one appears to be the use of the .bd-navbar class to add additional styling when using offcanvas for menu items (this is a little different for no menu items.

2dareis2do commented 6 months ago

Not sure this is included with npm

site/assets/scss/_navbar.scss

2dareis2do commented 6 months ago

One workaround it seems is to apply the bg-primary class to the off canvas element.

thomaspark commented 6 months ago

Hi @2dareis2do, is there any css on your site that might be making the offcanvas text color white?

It looks ok here

Screenshot 2024-04-17 at 12 25 07 PM

2dareis2do commented 6 months ago

Thanks @thomaspark

The issue is that if you use off canvas for the nav, similar to get-bootstrap.com, then the background colour is also white and the text is white. The workaround i have is to add the background class similar to how it is done on the on screen nav. get bootstrap seems to have site specific scss to handle this.

Screenshot 2024-04-17 at 17 56 31 Screenshot 2024-04-17 at 17 56 47

I have attached 2 screen shots that so nav working in both light and dark modes (media query).

thomaspark commented 6 months ago

Ah thanks, that seems like a nice solution.