Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Online Bootstrap Editor

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>

<body>

<div class="container">
  <h2>Learn</h2>
  <ul class="nav nav-tabs">
    <li class="active"><a href="#home">Home</a></li>
    <li><a href="#two">Java</a></li>
    <li><a href="#three">CSS</a></li>
    <li><a href="#four">Bootstrap</a></li>
    <li><a href="#five">jQuery</a></li>
  </ul>

  <div class="tab-content">
    <div id="home" class="tab-pane fade in active">
      <h3>Home</h3>
      <p>This is demo text!</p>
    </div>
    <div id="two" class="tab-pane fade">
      <h3>PHP</h3>
      <p>This is demo text!</p>
    </div>
    <div id="three" class="tab-pane fade">
      <h3>C#.NET</h3>
      <p>This is demo text!</p>
    </div>
    <div id="four" class="tab-pane fade">
      <h3>Ruby</h3>
      <p>This is demo text!</p>
    </div>
     <div id="five" class="tab-pane fade">
      <h3>HTML5</h3>
      <p>This is demo text!</p>
    </div>
  </div>
</div>

<script>
$(document).ready(function(){
    $(".nav-tabs a").click(function(){
        $(this).tab('show');
    });
    $('.nav-tabs a').on('show.bs.tab', function(){
        alert('準備顯示新內容');
    });
    $('.nav-tabs a').on('shown.bs.tab', function(){
        alert('新內容已顯示');
    });
    $('.nav-tabs a').on('hide.bs.tab', function(e){
        alert('準備隱藏舊內容');
    });
    $('.nav-tabs a').on('hidden.bs.tab', function(){
        alert('舊內容已隱藏');
    });
});

</script>

</body>
</html>

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.