Menu

Wednesday, July 27, 2011

JQuery - UI Tab

Download the necessary js and css file from here. I have downloaded these files with smoothness theme.

<html>
<head>
    <script type="text/javascript" src="scripts/jquery-1.5.1.min.js"></script>
    <script type="text/javascript" src="scripts/jquery-ui-1.8.14.custom.min.js"></script>
    <link href="css/jquery-ui-1.8.14.custom.css" rel="stylesheet"></script>

    <style>
    #tabs{
      width: 300px;
      font-size: 12px;
    }
    </style>
    <script type="text/javascript">
       $(function() {
           $('#tabs').tabs();
           //Tab on mouse over
           //$('#tabs').tabs({event: "mouseover"});
       });
    </script>
</head>

<body>
  <div id="tabs">
    <ul>
      <li><a href="#book">Tab 1</a></li>
      <li><a href="#tab2">Tab 2</a></li>
      <li><a href="#tab3">Tab 3</a></li>
    </ul>
  <div id="book">
      <p>A combination of economic factors resulted in Indian expats waking up this morning to find that the rupee had strengthened considerably – directly hitting their savings.</p>
  </div>
  <div id="tab2">
      <p>Norwegian police said they mistakenly released an alert on Wednesday saying they were searching for a man who identified with mass killer Anders Behring Breivik.</p>
  </div>
  <div id="tab3">
      Content of the tab 3
  </div>
</div>
</body>

</html> 

The tabs will be like this