Jump to content

Navigation bar and bootstrap plugin how does this work?

Recommended Posts

Hello, this code below is from an example on the site.

It looks sort of interesting, and I guess this should work out, what I don't quite know how to go about this, is bootstrap, it is a plugin from what I have gathered.

Where or what do I do with this plugin?

<button class="tablink" onclick="openPage('Home', this, 'red')">Home</button>
<button class="tablink" onclick="openPage('gallery', this, 'green')" id="defaultOpen">News</button>

<div id="Home" class="tabcontent">
  <p>Home is where the heart is..</p>

<div id="News" class="tabcontent">
  <p>Some news this fine day!</p>

function openPage(pageName,elmnt,color) {
  var i, tabcontent, tablinks;
  tabcontent = document.getElementsByClassName("tabcontent");
  for (i = 0; i < tabcontent.length; i++) {
    tabcontent[i].style.display = "none";
  tablinks = document.getElementsByClassName("tablink");
  for (i = 0; i < tablinks.length; i++) {
    tablinks[i].style.backgroundColor = "";
  document.getElementById(pageName).style.display = "block";
  elmnt.style.backgroundColor = color;

// Get the element with id="defaultOpen" and click on it


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...