[Bootstrap] 8. 'Collapse', data-target, data-toggle & data-parent

Using Bootstrap JavaScript Plugins

If we want to add behavior to our website, which of the following will NOT work?

  • Updating our HTML with data attributes that the Bootstrap JavaScript Library requires.
  • Adding Bootstrap CSS classes to our HTML that the Bootstrap Library requires.
  • Writing JavaScript to perform the behavior.

Screen Readers

If we have content that we want to be hidden for visual browsers but show up for screen readers, what class should we use?

Answer: sr-only

Accordion to Schedule

The Transportation Safety Board has mandated that we add a few requirements to our site. Apparently it’s some kind of law that we need to disclose safety concerns. Complete the following tasks to implement an Accordion using the Bootstrap Collapse Plugin so we don’t scare people all at once.

<!DOCTYPE html>
<html>
  <head>
    <title>Blasting Off With Bootstrap</title>
    <link href=‘css/bootstrap.min.css‘ rel=‘stylesheet‘>
    <link href=‘css/main.css‘ rel=‘stylesheet‘>
  </head>
  <body>
    <div class=‘navbar navbar-default navbar-static-top‘>
      <div class=‘container‘>
        <a href=‘/‘ class=‘navbar-brand‘>Blasting Off With Bootstrap</a>

        <ul class=‘nav navbar-nav navbar-right‘>
          <li><a href=‘tickets.html‘>Tickets</a></li>
          <li><a href=‘stations.html‘>Stations</a></li>
          <li><a href=‘about.html‘>About</a></li>
        </ul>
      </div>
    </div>
    <div class=‘container‘>
      <div class=‘row well well-lg‘>
        <div class=‘col-md-6‘>
          <h2>The Fastest Way to Space</h2>
          <p class=‘lead‘>Make your way to space in the comfort of your own rocket, elevator or transporter.</p>
          <button type=‘button‘ class=‘btn btn-lg btn-default‘>Take the Tour</button>
          <button type=‘button‘ class=‘btn btn-lg btn-primary‘>Book Tickets Now</button>
        </div>
        <div class=‘col-md-6 visible-md visible-lg‘>
          <img src=‘images/img-header.jpg‘ alt=‘Blast off with Bootstrap‘ />
        </div>
      </div>
      <div class=‘row text-center features‘>
        <div class=‘col-sm-4 col-xs-10 col-xs-offset-1 col-sm-offset-0‘>
          <i class=‘glyphicon glyphicon-briefcase‘></i>
          <h3>Book Today!</h3>
          <p>Even if you‘re traveling tomorrow, you can still get tickets today. We have a number of conveniently located ports around the globe to service everyone.</p>
        </div>

        <div class=‘col-sm-4 col-xs-6‘>
          <i class=‘glyphicon glyphicon-random‘></i>
          <h3>Go Anywhere</h3>
          <p>If you need to get to space today, why not try out a transporter? Despite the claims, there are have been no deaths in the last 6 weeks!</p>
        </div>

        <div class=‘col-sm-4 col-xs-6‘>
          <i class=‘glyphicon glyphicon-send‘></i>
          <h3>RocketBus&reg;</h3>
          <p>For cheapest fares, catch the next RocketBus&reg; to the stars. Cheaper on your wallet, and easiest way to make friends.</p>
        </div>
      </div>
    </div>
    <div class=‘quote‘>
      <div class=‘container‘>
        <blockquote>
          <p>Any sufficiently advanced technology is indistinguishable from magic.</p>
          <footer>Arthur C. Clarke in <cite title="Source Title">Profiles of the Future</cite></footer>
        </blockquote>
      </div>
    </div>
    <div class=‘container transport-systems‘>
      <div class=‘row‘>
        <div class=‘col-md-10 col-md-offset-1‘>
          <h2>Our Transport Systems</h2>
          <p>Learn more about our transport systems to find out which one is right for you. Pick out the mode of transport that works for your budget and risk level.</p>
        </div>
      </div>

      <div class=‘row text-center‘>
        <div class=‘transporter col-md-3 col-md-offset-1 well well-sm‘>
          <h3>Transporter</h3>
          <ul class=‘list-unstyled‘>
            <li>8 second travel time</li>
            <li>Chance of death only 1 in 7,593</li>
            <li>Low price of only $15.99!</li>
          </ul>
          <p><button class=‘btn btn-info‘><i class=‘glyphicon glyphicon-transfer‘></i> Beam Me Up!</button></p>
        </div>
        <div class=‘space-elevator col-md-3 col-md-offset-1 well well-sm‘>
          <h3>Space Elevator</h3>
          <ul class=‘list-unstyled‘>
            <li>8 hour scenic ride</li>
            <li>Only 1 horrific death per 12,456</li>
            <li>Only $45.99 if you book today!</li>
          </ul>
          <p><button class=‘btn btn-info‘><i class=‘glyphicon glyphicon-sort‘></i> Board the Elevator!</button></p>
        </div>
        <div class=‘rocketbus col-md-3 col-md-offset-1 well well-sm‘>
          <h3>RocketBus</h3>
          <ul class=‘list-unstyled‘>
            <li>8 minute scenic ride</li>
            <li>Plunging death rate of under 1/100k</li>
            <li>$74.99 lets you blast off today!</li>
          </ul>
          <p><button class=‘btn btn-info‘><i class=‘glyphicon glyphicon-plane‘></i> Blast Off!</button></p>
        </div>
      </div>
    </div>
    <div class=‘quote‘>
      <div class=‘container‘>
        <blockquote>
          <p>A dream that became a reality and spread throughout the stars.</p>
          <footer>Captain Kirk in <cite title="Source Title">Whom Gods Destroy</cite></footer>
        </blockquote>
      </div>
    </div>
    <div class=‘container‘>
      <div class=‘row‘>
        <div class=‘col-md-8‘>
          <h2>Plan Your Trip Today!</h2>

          <ul class=‘nav nav-tabs‘>
            <li class=‘active‘><a href=‘#time‘>Todays Times</a></li>
            <li><a href=‘#deals‘>Hot Deals</a></li>
            <li><a href=‘#forecast‘>Forecast</a></li>
          </ul>

          <div class=‘tab-content‘>
            <div class=‘tab-pane fade active‘ id=‘time‘>
              <p>Todays Time here</p>
            </div>
            <div class=‘tab-pane fade‘ id=‘deals‘>
              <p>Deals here</p>
            </div>
            <div class=‘tab-pane fade‘ id=‘forecast‘>
              <p>Forecast</p>
            </div>
          </div>
        </div>
        <div class=‘col-md-3 col-md-offset-1‘>
          <div class=‘panel-group‘>
            <div class=‘panel panel-success‘>
              <div class=‘panel-heading‘>
                <h4 class=‘panel-title‘>
                  <a href=‘#systemsOperational‘>All Systems Operational</a>
                </h4>
              </div>
              <div id=‘systemsOperational‘ class=‘panel-collapse‘>
                <div class=‘panel-body‘>
                  <p>All systems are operational</p>
                  <ul class=‘list-unstyled‘>
                    <li><i class=‘glyphicon glyphicon-ok‘></i>  Transporters</li>
                    <li><i class=‘glyphicon glyphicon-ok‘></i>  Space Elevator</li>
                    <li><i class=‘glyphicon glyphicon-ok‘></i>  RocketBus</li>
                  </ul>
                </div>
              </div>
            </div>

            <div class=‘panel panel-warning‘>
              <div class=‘panel-heading‘>
                 <h4 class=‘panel-title‘>
                   <a href=‘#weatherAlert‘>Weather Alert</a>
                 </h4>
              </div>
              <div id=‘weatherAlert‘ class=‘panel-collapse‘>
                <div class=‘panel-body‘>
                  <p>The National Weather Service has issued a solar flare watch for the following time periods. Please plan accordingly:</p>
                  <ul class=‘list-unstyled‘>
                    <li><strong>February 9th, 21:43</strong></li>
                    <li><strong>May 18, 19:82</strong></li>
                    <li><strong>July 4, 08:42</strong></li>
                  </ul>
                </div>
              </div>
            </div>

            <div class=‘panel panel-danger‘>
              <div class=‘panel-heading‘>
                <h4 class=‘panel-title‘>
                  <a href=‘#transportationWarning‘>Transportation Generals Warning: Transporters</a>
                </h4>
              </div>
              <div id=‘transportationWarning‘ class=‘panel-collapse‘>
                <div class=‘panel-body‘>
                  <p>Technically, transporting means making a clone of yourself and killing off the other one. If you believe in a soul, you should be aware of this fact before attempting travel using a transporter.</p>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class=‘footer‘>
      <div class=‘container‘>
        <div class=‘row‘>
          <div class=‘col-md-3 col-sm-4 col-xs-6‘>
            <h4>Who We Are</h4>
            <p><i>Blasting Off With Bootstrap</i> is the fastest way to space. <a href=‘tickets.html‘>Book your ticket today</a>!</p>
            <p><a href=‘about.html‘>More About Us <i class=‘glyphicon glyphicon-arrow-right‘></i></a></p>
          </div>

          <div class=‘col-md-offset-1 col-sm-2 col-xs-6‘>
            <h4>Links</h4>
            <ul class=‘list-unstyled‘>
              <li><a href=‘/‘>Home</a></li>
              <li><a href=‘tickets.html‘>Tickets</a></li>
              <li><a href=‘stations.html‘>Stations</a></li>
            </ul>
          </div>

          <div class=‘clearfix visible-xs‘></div>

          <div class=‘col-sm-2 col-xs-6‘>
            <h4>Stay in Touch</h4>
            <ul class=‘list-unstyled‘>
              <li><a href=‘about.html‘>About</a></li>
              <li><a href=‘contact.html‘>Contact Us</a></li>
              <li><a href=‘/blog‘>Blog</a></li>
              <li><a href=‘http://twitter.com/codeschool‘>Twitter</a></li>
              <li><a href=‘http://facebook.com/codeschool‘>Facebook</a></li>
            </ul>
          </div>

          <div class=‘col-md-3 col-md-offset-1 col-sm-4 col-xs-6‘>
            <h4>Contact Us</h4>
            <ul class=‘list-unstyled‘>
              <li><i class=‘glyphicon glyphicon-globe‘></i> Orlando, FL</li>
              <li><i class=‘glyphicon glyphicon-phone‘></i> 1-555-blast-off</li>
              <li><i class=‘glyphicon glyphicon-envelope‘></i> <a href=‘mailto:[email protected]‘>[email protected]</a></li>
            </ul>
            <p>Blasting Off With Bootstrap &copy;2214.</p>
          </div>
        </div>
      </div>
    </div>

    <script src=‘https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js‘></script>
    <script src=‘js/bootstrap.min.js‘></script>
    <script>
      $(function() {
        $(‘.nav-tabs a‘).click(function (e) {
          e.preventDefault();
          $(this).tab(‘show‘);
        });
      });
    </script>
  </body>
</html>

To start off, let’s hide all the content within each panel for when the page loads. Don’t hide the panel titles though – those are the links. What we need to do is start the body of each accordion item as collapsed.

              <div id=‘transportationWarning‘ class=‘panel-collapse collapse‘>
                <div class=‘panel-body‘>
                  <p>Technically, transporting means making a clone of yourself and killing off the other one. If you believe in a soul, you should be aware of this fact before attempting travel using a transporter.</p>
                </div>
              </div>

Now all of the panels are collapsed when the page loads! Add a class of in to the body of the "All Systems Operational" panel to make sure it shows when the page loads.

If you‘re curious how this in class works with the Collapse Plugin, read theBootstrap Collapse Plugin Documentation.

              <div id=‘systemsOperational‘ class=‘panel-collapse collapse in‘>
                <div class=‘panel-body‘>
                  <p>All systems are operational</p>

We‘re getting somewhere! The page looks correct when it loads, but our links don‘t do anything yet. Let‘s make the 2nd panel functional first – the "Weather Alert".

Update the "Weather Alert" link to use the Collapse Plugin. You‘ll need to add 2 data attributes to the link to make this work.

         <div class=‘panel panel-warning‘>
              <div class=‘panel-heading‘>
                 <h4 class=‘panel-title‘>
                   <a href=‘#weatherAlert‘ data-toggle="collapse" data-target="#weatherAlert">Weather Alert</a>
                 </h4>
              </div>
              <div id=‘weatherAlert‘ class=‘panel-collapse collapse‘>
                <div class=‘panel-body‘>
                  <p>The National Weather Service has issued a solar flare watch for the following time periods. Please plan accordingly:</p>
                  <ul class=‘list-unstyled‘>
                    <li><strong>February 9th, 21:43</strong></li>
                    <li><strong>May 18, 19:82</strong></li>
                    <li><strong>July 4, 08:42</strong></li>
                  </ul>
                </div>
              </div>

Convert the links for "All Systems Operational" and "Transportation Generals Warning: Transporters" to also use the Collapse Plugin.

 data-toggle="collapse" data-target="#systemsOperational"

 data-toggle="collapse" data-target="#transportationWarning"

--------------

<!DOCTYPE html>
<html>
  <head>
    <title>Blasting Off With Bootstrap</title>
    <link href=‘css/bootstrap.min.css‘ rel=‘stylesheet‘>
    <link href=‘css/main.css‘ rel=‘stylesheet‘>
  </head>
  <body>
    <div class=‘navbar navbar-default navbar-static-top‘>
      <div class=‘container‘>
        <a href=‘/‘ class=‘navbar-brand‘>Blasting Off With Bootstrap</a>

        <ul class=‘nav navbar-nav navbar-right‘>
          <li><a href=‘tickets.html‘>Tickets</a></li>
          <li><a href=‘stations.html‘>Stations</a></li>
          <li><a href=‘about.html‘>About</a></li>
        </ul>
      </div>
    </div>
    <div class=‘container‘>
      <div class=‘row well well-lg‘>
        <div class=‘col-md-6‘>
          <h2>The Fastest Way to Space</h2>
          <p class=‘lead‘>Make your way to space in the comfort of your own rocket, elevator or transporter.</p>
          <button type=‘button‘ class=‘btn btn-lg btn-default‘>Take the Tour</button>
          <button type=‘button‘ class=‘btn btn-lg btn-primary‘>Book Tickets Now</button>
        </div>
        <div class=‘col-md-6 visible-md visible-lg‘>
          <img src=‘images/img-header.jpg‘ alt=‘Blast off with Bootstrap‘ />
        </div>
      </div>
      <div class=‘row text-center features‘>
        <div class=‘col-sm-4 col-xs-10 col-xs-offset-1 col-sm-offset-0‘>
          <i class=‘glyphicon glyphicon-briefcase‘></i>
          <h3>Book Today!</h3>
          <p>Even if you‘re traveling tomorrow, you can still get tickets today. We have a number of conveniently located ports around the globe to service everyone.</p>
        </div>

        <div class=‘col-sm-4 col-xs-6‘>
          <i class=‘glyphicon glyphicon-random‘></i>
          <h3>Go Anywhere</h3>
          <p>If you need to get to space today, why not try out a transporter? Despite the claims, there are have been no deaths in the last 6 weeks!</p>
        </div>

        <div class=‘col-sm-4 col-xs-6‘>
          <i class=‘glyphicon glyphicon-send‘></i>
          <h3>RocketBus&reg;</h3>
          <p>For cheapest fares, catch the next RocketBus&reg; to the stars. Cheaper on your wallet, and easiest way to make friends.</p>
        </div>
      </div>
    </div>
    <div class=‘quote‘>
      <div class=‘container‘>
        <blockquote>
          <p>Any sufficiently advanced technology is indistinguishable from magic.</p>
          <footer>Arthur C. Clarke in <cite title="Source Title">Profiles of the Future</cite></footer>
        </blockquote>
      </div>
    </div>
    <div class=‘container transport-systems‘>
      <div class=‘row‘>
        <div class=‘col-md-10 col-md-offset-1‘>
          <h2>Our Transport Systems</h2>
          <p>Learn more about our transport systems to find out which one is right for you. Pick out the mode of transport that works for your budget and risk level.</p>
        </div>
      </div>

      <div class=‘row text-center‘>
        <div class=‘transporter col-md-3 col-md-offset-1 well well-sm‘>
          <h3>Transporter</h3>
          <ul class=‘list-unstyled‘>
            <li>8 second travel time</li>
            <li>Chance of death only 1 in 7,593</li>
            <li>Low price of only $15.99!</li>
          </ul>
          <p><button class=‘btn btn-info‘><i class=‘glyphicon glyphicon-transfer‘></i> Beam Me Up!</button></p>
        </div>
        <div class=‘space-elevator col-md-3 col-md-offset-1 well well-sm‘>
          <h3>Space Elevator</h3>
          <ul class=‘list-unstyled‘>
            <li>8 hour scenic ride</li>
            <li>Only 1 horrific death per 12,456</li>
            <li>Only $45.99 if you book today!</li>
          </ul>
          <p><button class=‘btn btn-info‘><i class=‘glyphicon glyphicon-sort‘></i> Board the Elevator!</button></p>
        </div>
        <div class=‘rocketbus col-md-3 col-md-offset-1 well well-sm‘>
          <h3>RocketBus</h3>
          <ul class=‘list-unstyled‘>
            <li>8 minute scenic ride</li>
            <li>Plunging death rate of under 1/100k</li>
            <li>$74.99 lets you blast off today!</li>
          </ul>
          <p><button class=‘btn btn-info‘><i class=‘glyphicon glyphicon-plane‘></i> Blast Off!</button></p>
        </div>
      </div>
    </div>
    <div class=‘quote‘>
      <div class=‘container‘>
        <blockquote>
          <p>A dream that became a reality and spread throughout the stars.</p>
          <footer>Captain Kirk in <cite title="Source Title">Whom Gods Destroy</cite></footer>
        </blockquote>
      </div>
    </div>
    <div class=‘container‘>
      <div class=‘row‘>
        <div class=‘col-md-8‘>
          <h2>Plan Your Trip Today!</h2>

          <ul class=‘nav nav-tabs‘>
            <li class=‘active‘><a href=‘#time‘>Todays Times</a></li>
            <li><a href=‘#deals‘>Hot Deals</a></li>
            <li><a href=‘#forecast‘>Forecast</a></li>
          </ul>

          <div class=‘tab-content‘>
            <div class=‘tab-pane fade active‘ id=‘time‘>
              <p>Todays Time here</p>
            </div>
            <div class=‘tab-pane fade‘ id=‘deals‘>
              <p>Deals here</p>
            </div>
            <div class=‘tab-pane fade‘ id=‘forecast‘>
              <p>Forecast</p>
            </div>
          </div>
        </div>
        <div class=‘col-md-3 col-md-offset-1‘>
          <div class=‘panel-group‘>
            <div class=‘panel panel-success‘>
              <div class=‘panel-heading‘>
                <h4 class=‘panel-title‘>
                  <a href=‘#systemsOperational‘ data-toggle="collapse" data-target="#systemsOperational">All Systems Operational</a>
                </h4>
              </div>
              <div id=‘systemsOperational‘ class=‘panel-collapse collapse in‘>
                <div class=‘panel-body‘>
                  <p>All systems are operational</p>
                  <ul class=‘list-unstyled‘>
                    <li><i class=‘glyphicon glyphicon-ok‘></i>  Transporters</li>
                    <li><i class=‘glyphicon glyphicon-ok‘></i>  Space Elevator</li>
                    <li><i class=‘glyphicon glyphicon-ok‘></i>  RocketBus</li>
                  </ul>
                </div>
              </div>
            </div>

            <div class=‘panel panel-warning‘>
              <div class=‘panel-heading‘>
                 <h4 class=‘panel-title‘>
                   <a href=‘#weatherAlert‘ data-toggle="collapse" data-target="#weatherAlert">Weather Alert</a>
                 </h4>
              </div>
              <div id=‘weatherAlert‘ class=‘panel-collapse collapse‘>
                <div class=‘panel-body‘>
                  <p>The National Weather Service has issued a solar flare watch for the following time periods. Please plan accordingly:</p>
                  <ul class=‘list-unstyled‘>
                    <li><strong>February 9th, 21:43</strong></li>
                    <li><strong>May 18, 19:82</strong></li>
                    <li><strong>July 4, 08:42</strong></li>
                  </ul>
                </div>
              </div>
            </div>

            <div class=‘panel panel-danger‘>
              <div class=‘panel-heading‘>
                <h4 class=‘panel-title‘>
                  <a href=‘#transportationWarning‘  data-toggle="collapse" data-target="#transportationWarning">Transportation Generals Warning: Transporters</a>
                </h4>
              </div>
              <div id=‘transportationWarning‘ class=‘panel-collapse collapse‘>
                <div class=‘panel-body‘>
                  <p>Technically, transporting means making a clone of yourself and killing off the other one. If you believe in a soul, you should be aware of this fact before attempting travel using a transporter.</p>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class=‘footer‘>
      <div class=‘container‘>
        <div class=‘row‘>
          <div class=‘col-md-3 col-sm-4 col-xs-6‘>
            <h4>Who We Are</h4>
            <p><i>Blasting Off With Bootstrap</i> is the fastest way to space. <a href=‘tickets.html‘>Book your ticket today</a>!</p>
            <p><a href=‘about.html‘>More About Us <i class=‘glyphicon glyphicon-arrow-right‘></i></a></p>
          </div>

          <div class=‘col-md-offset-1 col-sm-2 col-xs-6‘>
            <h4>Links</h4>
            <ul class=‘list-unstyled‘>
              <li><a href=‘/‘>Home</a></li>
              <li><a href=‘tickets.html‘>Tickets</a></li>
              <li><a href=‘stations.html‘>Stations</a></li>
            </ul>
          </div>

          <div class=‘clearfix visible-xs‘></div>

          <div class=‘col-sm-2 col-xs-6‘>
            <h4>Stay in Touch</h4>
            <ul class=‘list-unstyled‘>
              <li><a href=‘about.html‘>About</a></li>
              <li><a href=‘contact.html‘>Contact Us</a></li>
              <li><a href=‘/blog‘>Blog</a></li>
              <li><a href=‘http://twitter.com/codeschool‘>Twitter</a></li>
              <li><a href=‘http://facebook.com/codeschool‘>Facebook</a></li>
            </ul>
          </div>

          <div class=‘col-md-3 col-md-offset-1 col-sm-4 col-xs-6‘>
            <h4>Contact Us</h4>
            <ul class=‘list-unstyled‘>
              <li><i class=‘glyphicon glyphicon-globe‘></i> Orlando, FL</li>
              <li><i class=‘glyphicon glyphicon-phone‘></i> 1-555-blast-off</li>
              <li><i class=‘glyphicon glyphicon-envelope‘></i> <a href=‘mailto:[email protected]‘>[email protected]</a></li>
            </ul>
            <p>Blasting Off With Bootstrap &copy;2214.</p>
          </div>
        </div>
      </div>
    </div>

    <script src=‘https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js‘></script>
    <script src=‘js/bootstrap.min.js‘></script>
    <script>
      $(function() {
        $(‘.nav-tabs a‘).click(function (e) {
          e.preventDefault();
          $(this).tab(‘show‘);
        });
      });
    </script>
  </body>
</html>

One Accordion at a Time

Our Accordion Component is using the JavaScript Collapse Plugin, but it’s missing something. Clicking on one link in the accordion should collapse the previously open item. In this case, we only want one panel to be open at any given time. Follow the tasks below to make this happen.

It turns out that using the data-target attribute with the Collapse Plugin manages just a single element. If you want to control multiple elements at once that share the same parent, you can instead use the data-parent attribute passing in a shared parent.

Update the "All Systems Operational" link to use this new attribute targeting the parent Panel Group element (.panel-group).

<a data-toggle=‘collapse‘ data-parent=‘.panel-group‘ href=‘#systemsOperational‘>All Systems Operational</a>

We‘re on the right track, but the other two panels in our accordion component don‘t know to collapse when the other ones are clicked. Go ahead and update the other two links to also point to the same parent.

<!DOCTYPE html>
<html>
  <head>
    <title>Blasting Off With Bootstrap</title>
    <link href=‘css/bootstrap.min.css‘ rel=‘stylesheet‘>
    <link href=‘css/main.css‘ rel=‘stylesheet‘>
  </head>
  <body>
    <div class=‘navbar navbar-default navbar-static-top‘>
      <div class=‘container‘>
        <a href=‘/‘ class=‘navbar-brand‘>Blasting Off With Bootstrap</a>

        <ul class=‘nav navbar-nav navbar-right‘>
          <li><a href=‘tickets.html‘>Tickets</a></li>
          <li><a href=‘stations.html‘>Stations</a></li>
          <li><a href=‘about.html‘>About</a></li>
        </ul>
      </div>
    </div>
    <div class=‘container‘>
      <div class=‘row well well-lg‘>
        <div class=‘col-md-6‘>
          <h2>The Fastest Way to Space</h2>
          <p class=‘lead‘>Make your way to space in the comfort of your own rocket, elevator or transporter.</p>
          <button type=‘button‘ class=‘btn btn-lg btn-default‘>Take the Tour</button>
          <button type=‘button‘ class=‘btn btn-lg btn-primary‘>Book Tickets Now</button>
        </div>
        <div class=‘col-md-6 visible-md visible-lg‘>
          <img src=‘images/img-header.jpg‘ alt=‘Blast off with Bootstrap‘ />
        </div>
      </div>
      <div class=‘row text-center features‘>
        <div class=‘col-sm-4 col-xs-10 col-xs-offset-1 col-sm-offset-0‘>
          <i class=‘glyphicon glyphicon-briefcase‘></i>
          <h3>Book Today!</h3>
          <p>Even if you‘re traveling tomorrow, you can still get tickets today. We have a number of conveniently located ports around the globe to service everyone.</p>
        </div>

        <div class=‘col-sm-4 col-xs-6‘>
          <i class=‘glyphicon glyphicon-random‘></i>
          <h3>Go Anywhere</h3>
          <p>If you need to get to space today, why not try out a transporter? Despite the claims, there are have been no deaths in the last 6 weeks!</p>
        </div>

        <div class=‘col-sm-4 col-xs-6‘>
          <i class=‘glyphicon glyphicon-send‘></i>
          <h3>RocketBus&reg;</h3>
          <p>For cheapest fares, catch the next RocketBus&reg; to the stars. Cheaper on your wallet, and easiest way to make friends.</p>
        </div>
      </div>
    </div>
    <div class=‘quote‘>
      <div class=‘container‘>
        <blockquote>
          <p>Any sufficiently advanced technology is indistinguishable from magic.</p>
          <footer>Arthur C. Clarke in <cite title="Source Title">Profiles of the Future</cite></footer>
        </blockquote>
      </div>
    </div>
    <div class=‘container transport-systems‘>
      <div class=‘row‘>
        <div class=‘col-md-10 col-md-offset-1‘>
          <h2>Our Transport Systems</h2>
          <p>Learn more about our transport systems to find out which one is right for you. Pick out the mode of transport that works for your budget and risk level.</p>
        </div>
      </div>
      <div class=‘row text-center‘>
        <div class=‘transporter col-md-3 col-md-offset-1 well well-sm‘>
          <h3>Transporter</h3>
          <ul class=‘list-unstyled‘>
            <li>8 second travel time</li>
            <li>Chance of death only 1 in 7,593</li>
            <li>Low price of only $15.99!</li>
          </ul>
          <p><button class=‘btn btn-info‘><i class=‘glyphicon glyphicon-transfer‘></i> Beam Me Up!</button></p>
        </div>
        <div class=‘space-elevator col-md-3 col-md-offset-1 well well-sm‘>
          <h3>Space Elevator</h3>
          <ul class=‘list-unstyled‘>
            <li>8 hour scenic ride</li>
            <li>Only 1 horrific death per 12,456</li>
            <li>Only $45.99 if you book today!</li>
          </ul>
          <p><button class=‘btn btn-info‘><i class=‘glyphicon glyphicon-sort‘></i> Board the Elevator!</button></p>
        </div>
        <div class=‘rocketbus col-md-3 col-md-offset-1 well well-sm‘>
          <h3>RocketBus</h3>
          <ul class=‘list-unstyled‘>
            <li>8 minute scenic ride</li>
            <li>Plunging death rate of under 1/100k</li>
            <li>$74.99 lets you blast off today!</li>
          </ul>
          <p><button class=‘btn btn-info‘><i class=‘glyphicon glyphicon-plane‘></i> Blast Off!</button></p>
        </div>
      </div>
    </div>
    <div class=‘quote‘>
      <div class=‘container‘>
        <blockquote>
          <p>A dream that became a reality and spread throughout the stars.</p>
          <footer>Captain Kirk in <cite title="Source Title">Whom Gods Destroy</cite></footer>
        </blockquote>
      </div>
    </div>
    <div class=‘container‘>
      <div class=‘row‘>
        <div class=‘col-md-8‘>
          <h2>Plan Your Trip Today!</h2>

          <ul class=‘nav nav-tabs‘>
            <li class=‘active‘><a href=‘#time‘>Todays Times</a></li>
            <li><a href=‘#deals‘>Hot Deals</a></li>
            <li><a href=‘#forecast‘>Forecast</a></li>
          </ul>

          <div class=‘tab-content‘>
            <div class=‘tab-pane fade active‘ id=‘time‘>
              <p>Todays Time here</p>
            </div>
            <div class=‘tab-pane fade‘ id=‘deals‘>
              <p>Deals here</p>
            </div>
            <div class=‘tab-pane fade‘ id=‘forecast‘>
              <p>Forecast</p>
            </div>
          </div>
        </div>
        <div class=‘col-md-3 col-md-offset-1‘>
          <div class=‘panel-group‘>
            <div class=‘panel panel-success‘>
              <div class=‘panel-heading‘>
                <h4 class=‘panel-title‘>
                  <a data-toggle=‘collapse‘ data-parent=‘.panel-group‘ href=‘#systemsOperational‘>All Systems Operational</a>
                </h4>
              </div>
              <div id=‘systemsOperational‘ class=‘panel-collapse collapse in‘>
                <div class=‘panel-body‘>
                  <p>All systems are operational</p>
                  <ul class=‘list-unstyled‘>
                    <li><i class=‘glyphicon glyphicon-ok‘></i>  Transporters</li>
                    <li><i class=‘glyphicon glyphicon-ok‘></i>  Space Elevator</li>
                    <li><i class=‘glyphicon glyphicon-ok‘></i>  RocketBus</li>
                  </ul>
                </div>
              </div>
            </div>

            <div class=‘panel panel-warning‘>
              <div class=‘panel-heading‘>
                <h4 class=‘panel-title‘>
                  <a data-toggle=‘collapse‘ data-parent=‘.panel-group‘ href=‘#weatherAlert‘>Weather Alert</a>
                </h4>
              </div>
              <div id=‘weatherAlert‘ class=‘panel-collapse collapse‘>
                <div class=‘panel-body‘>
                  <p>The National Weather Service has issued a solar flare watch for the following time periods. Please plan accordingly:</p>
                  <ul class=‘list-unstyled‘>
                    <li><strong>February 9th, 21:43</strong></li>
                    <li><strong>May 18, 19:82</strong></li>
                    <li><strong>July 4, 08:42</strong></li>
                  </ul>
                </div>
              </div>
            </div>

            <div class=‘panel panel-danger‘>
              <div class=‘panel-heading‘>
                <h4 class=‘panel-title‘>
                  <a data-toggle=‘collapse‘ data-parent=‘.panel-group‘ href=‘#transportationWarning‘>Transportation Generals Warning: Transporters</a>
                </h4>
              </div>
              <div id=‘transportationWarning‘ class=‘panel-collapse collapse‘>
                <div class=‘panel-body‘>
                  <p>Technically, transporting means making a clone of yourself and killing off the other one. If you believe in a soul, you should be aware of this fact before attempting travel using a transporter.</p>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class=‘footer‘>
      <div class=‘container‘>
        <div class=‘row‘>
          <div class=‘col-md-3 col-sm-4 col-xs-6‘>
            <h4>Who We Are</h4>
            <p><i>Blasting Off With Bootstrap</i> is the fastest way to space. <a href=‘tickets.html‘>Book your ticket today</a>!</p>
            <p><a href=‘about.html‘>More About Us <i class=‘glyphicon glyphicon-arrow-right‘></i></a></p>
          </div>

          <div class=‘col-md-offset-1 col-sm-2 col-xs-6‘>
            <h4>Links</h4>
            <ul class=‘list-unstyled‘>
              <li><a href=‘/‘>Home</a></li>
              <li><a href=‘tickets.html‘>Tickets</a></li>
              <li><a href=‘stations.html‘>Stations</a></li>
            </ul>
          </div>

          <div class=‘clearfix visible-xs‘></div>

          <div class=‘col-sm-2 col-xs-6‘>
            <h4>Stay in Touch</h4>
            <ul class=‘list-unstyled‘>
              <li><a href=‘about.html‘>About</a></li>
              <li><a href=‘contact.html‘>Contact Us</a></li>
              <li><a href=‘/blog‘>Blog</a></li>
              <li><a href=‘http://twitter.com/codeschool‘>Twitter</a></li>
              <li><a href=‘http://facebook.com/codeschool‘>Facebook</a></li>
            </ul>
          </div>

          <div class=‘col-md-3 col-md-offset-1 col-sm-4 col-xs-6‘>
            <h4>Contact Us</h4>
            <ul class=‘list-unstyled‘>
              <li><i class=‘glyphicon glyphicon-globe‘></i> Orlando, FL</li>
              <li><i class=‘glyphicon glyphicon-phone‘></i> 1-555-blast-off</li>
              <li><i class=‘glyphicon glyphicon-envelope‘></i> <a href=‘mailto:[email protected]‘>[email protected]</a></li>
            </ul>
            <p>Blasting Off With Bootstrap &copy;2214.</p>
          </div>
        </div>
      </div>
    </div>

    <script src=‘https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js‘></script>
    <script src=‘js/bootstrap.min.js‘></script>
    <script>
      $(function() {
        $(‘.nav-tabs a‘).click(function (e) {
          e.preventDefault();
          $(this).tab(‘show‘);
        });
      });
    </script>
  </body>
</html>

[Bootstrap] 8. 'Collapse', data-target, data-toggle & data-parent

时间: 2024-08-26 04:45:43

[Bootstrap] 8. 'Collapse', data-target, data-toggle & data-parent的相关文章

Android App data write as file data with synchronous Demo

1 package com.android.utils; 2 3 import java.io.File; 4 import java.io.IOException; 5 import java.io.RandomAccessFile; 6 import java.util.Arrays; 7 8 import android.app.Activity; 9 import android.util.Log; 10 11 12 /** 13 * 在一些对数据实时性要求比较高的场合,如随时可能断电的

错误描述:请求“System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089”类型的权限已失败

错误描述:请求“System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089”类型的权限已失败. 解决办法:在配置文件web.config中<trust></trust>节点,把<trust level="WSS_Minimal" originUrl=""

混合 Data Warehouse 和 Big Data 倉庫的新架構

(讀書筆記)許多公司,儘管想導入 Big Data,仍必須繼續用 Data Warehouse 來管理結構化的營運數據.系統記錄.而 Big Data 的出現,為 Data Warehouse 提供了一個互補的機會,而不是取代後者. 高度結構化的營運資料 (data,數據),仍然可保留在 Data Warehouse 中:而分散式 (distributed) 的資料,以及會即時改變的資料,則可交由基於 Hadoop 的架構來控制. 圖 1 傳統的 Data Warehouse 和 Data Ma

jQuery.data() 与 jQuery(elem).data()源码解读

之前一直以为 jQuery(elem).data()是在内部调用了 jQuery.data(),看了代码后发现不是.但是这两个还是需要放在一起看,因为它们内部都使用了jQuery的数据缓存机制.好吧,重点就是data_user对象,跟另一个data_priv是姐妹~~ 先来看下jQuery.data(): 它调用了data_user.access( elem, name, data ); 那么data_user到底是什么鬼呢?? 我们看到,它是由Data构造的实例,Data构造器都做了一些什么呢

Mysql text类型字段存储提示错误信息 String data,right truncated:1406 Data too long for column &#39;content&#39; at row 1

String data,right truncated:1406 Data too long for column 'content' at row 1 当Mysql提示如下时: 1.首先查看存入的文本内容的大小,根据内容大小设置类型 如果超出,根据大小进行更换类型 2.如果还是超出那可能是Mysql根据配置文件限制Server接受数据包大小,有时候大的插入和更新会受max_allowed_packet参数限制,导致写入或者更新失败. 查看目前配置: 代码如下: 以上说明目前的配置是:60 M

编译器错误消息: CS0122: “System.Data.DataRow.DataRow(System.Data.DataRowBuilder)”不可访问,因为它受保护级别限制

编译错误 说明: 在编译向该请求提供服务所需资源的过程中出现错误.请检查下列特定错误详细信息并适当地修改源代码. 编译器错误消息: CS0122: "System.Data.DataRow.DataRow(System.Data.DataRowBuilder)"不可访问,因为它受保护级别限制 源错误:   行 17: 行 18: DataTable dt = new DataTable(); 行 19: System.Data.DataRow r = new DataRow(); 行

System.Data.DataRow.DataRow(System.Data.DataRowBuilder 因为它受保护级别限制 如何解决,解决办法

错误 1 "System.Data.DataRow.DataRow(System.Data.DataRowBuilder)"不可访问,因为它受保护级别限制 原因:DataRow dr= new DataRow();    // 错误,DataRow 不能直接new 解决办法: DataRow dr :或者,使用DataTable dt = new DataTable(); //对应的行,使用dt[],例如第一行  dt[0]

jquery data属性 attr vs data

html5的自定义data属性相信大家都不会陌生,有了它你可以绑定所需的数据到指定元素上.然后通过jquery设置.获取数据,简直开心的不行啊.想到设置.获取元素属性值,大家一定首先想到了jquery的.attr()方法,但是你一定知道jquery还有个.data()的方法.本人以前一直萌(傻)萌(傻)哒(的)以为这两个方法在处理data属性过程中实现的效果是一样的,只不过.data()方法官方更推荐使用(看名字就感觉人家是正规军).但后来本人在做项目的过程中发现,这两种方法处理data属性并不

以Excel 作为Data Source,将data导入db

将Excel作为数据源,将数据导入db,是SSIS的一个简单的应用,下图是示例Excel,数据列是code和name 第一部分,Excel中的数据类型是数值类型 1,使用SSDT创建一个package,创建Excel data source component,SSDT会在Connection Managers中创建一个Excel的connection 由于示例Excel的首行是列名,所以需要勾选"First row has column names",Excel connection

System.Data.Dbtype转换为System.Data.SqlDbType

最近在做一些OM Mapping的准备工作,新学了一招. 如果要将System.Data.Dbtype转换为System.Data.SqlDbType,以前以为要写Switch Case语句.其实有很简单的方法: ??????? private System.Data.SqlDbType ConvertToSqlDbType(System.Data.DbType pSourceType)??????? {??????????? SqlParameter paraConver = new SqlP