2

I am creating a webpage using Twitter Bootstrap 3. My instinct using the navbar was to have each item navigate to a new href. However, I've seen this handled in different ways.

Some pages do navigate to a new href and trigger a page load, presumably using a template of some sort to use the same navbar code across all their html pages, as discussed in this SO question.

Other pages I've seen appear to be hiding or displaying divs with content. At first glance it appears that this would come with a tradeoff--on the one hand, once loaded, you can have a snappy, responsive page. On the other, initial page loads could end up being huge on a large website.

Other pages use the navbar items to scroll to a particular place in a very tall page. When I use these pages, I find navigation not using the navbar items to be disorienting. This solution, too, I would imagine becomes less attractive as page size increases.

Still others use the navbar items to add a query parameter that reloads the page. I'm not sure how these do it, and it is the least common approach that I've found.

My question is: what is the "Bootstrap Way" to do it? No doubt all are valid. But is there a discussion somewhere of the tradeoffs and motivations for choosing one over the other? For small pages, the hiding divs or scrolling seems like a good solution, as you could end up with what appears like quick loading of content to the user. But in big pages it seems like you would want another approach. Perhaps you could go with the div approach for the top level summary items and then the href approach to navigate down a level.

Does anyone have any suggestions about what has worked for them? Or pointers to articles discussing efficient use of the navbar?

Community
  • 1
  • 1
user1978019
  • 3,008
  • 1
  • 29
  • 38
  • what i am interested in is how to handle the navbar if it was the same for every page on your site. see [here](http://stackoverflow.com/questions/23818206/bootstrap-navbar-interactive-structure) – HattrickNZ May 28 '14 at 21:24

1 Answers1

2

I never found any discussion on this one way or the other. Bootstrap itself seems to use the hrefs approach. As a user, I find this approach is the easiest to wrap your head around.

Since I couldn't find any templates on how to use this approach efficiently, I created my own template called bootstrap-baked. The html for the navbar, which is shared across all the top-level pages, is DRYed out in a single place using the grunt-bake template task. If you're just looking to create a basic site using Bootstrap, this might be a good place to start.

It uses hrefs to navigate via the navbar, so each new page is a new html file. It comes with all the tasks provided with the yeoman webapp generator (configured to play nice with grunt-bake), and a responsive navbar.

user1978019
  • 3,008
  • 1
  • 29
  • 38