Bootstrap 4 Default Tab-pane Active Fade In Not Working
Answer :
USE fade show
instead of fade in
in the tab-content classes
Reference https://getbootstrap.com/docs/4.0/components/navs/?#javascript-behavior
This is the way of solving it on bootstrap 4. But in bootstrap 3, your code should be working.
Related question for bootstrap 3. Bootstrap tab - active class not working on page loading
<!-- 1. BOOTSTRAP v4.0.0 CSS !--> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> <!-- 2. GOOGLE JQUERY JS v3.2.1 JS !--> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <!-- 3. BOOTSTRAP v4.0.0 JS !--> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script> <!-- Toggleable / Dynamic Tabs --> <nav class="nav nav-tabs nav-justified"> <a class="nav-item nav-link active" data-toggle="tab" href="#home">Home</a> <a class="nav-item nav-link" data-toggle="tab" href="#menu1">Menu 1</a> <a class="nav-item nav-link" data-toggle="tab" href="#menu2">Menu 2</a> <a class="nav-item nav-link disabled" data-toggle="tab" href="#menu3">Disabled</a> </nav> <div class="tab-content"> <div id="home" class="tab-pane fade show active"> <h3>HOME</h3> <p>Some content in menu HOME.</p> </div> <div id="menu1" class="tab-pane fade"> <h3>Menu 1</h3> <p>Some content in menu 1.</p> </div> <div id="menu2" class="tab-pane fade"> <h3>Menu 2</h3> <p>Some content in menu 2.</p> </div> <div id="menu3" class="tab-pane fade"> <h3>Menu 3</h3> <p>Some content in menu 3.</p> </div> </div>
Comments
Post a Comment