samedi 18 juin 2016

Tab panels with maxcdn css dont work


This is basic JQuery to show and hide panels when a list item in the menu is clicked but I can't get my code to work.The CSS I am using is max cdn so I am not sure if I need to have my own CSS file for this.

    <!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <!-- Latest compiled and minified CSS -->
        <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
        <!-- jQuery library -->
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
        <!-- Latest compiled JavaScript -->
        <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootswatch/3.3.6/sandstone/bootstrap.min.css"></script>
        <script src ="PhpProject1/jquery.js"></script>
        <script>
            $(document).ready(function() {
            $('.tabs a').click(function(){
                var $this =$(this);
                $('.panel').hide();
                $('.tabs a.active').removeClass('active');
                $this.addClass('active').blur();});
            }); // end ready
        </script>
    </head>
    <body>
        <div id="tabContainer">
            <h2>Tab Heading</h2>
            <div class=col-xs-3">
                <ul class="nav nav-tabs" role="tablist">
                <li  class="active"><a href="#">Home</a></li>
                <li><a href="#">Menu1</a></li>
                <li><a href="#">Menu2</a></li>
                <li><a href="#">Menu3</a></li>
              </ul>
                <div id ="panel1" class="panel panel-primary">
                    <div class="panel-heading">   
                     #panel1
                    </div>
                    <div class="panel-body">content
                    </div>    
                </div>
                <div id ="panel2" class="panel panel-primary">
                    <div class="panel-heading">   
                     #panel2
                    </div>
                    <div class="panel-body">content
                    </div>    
                </div>
                <div id ="panel3" class="panel panel-primary">
                    <div class="panel-heading">   
                     #panel3
                    </div>
                    <div class="panel-body">content
                    </div>    
                </div>
            </div>
    </body>
</html>

Aucun commentaire:

Enregistrer un commentaire