Now it is very easy to build a Tab control in Web applications using JQuery Tabs.
Steps to do.
Step - 1
Include following javascripts file to the page.
- jquery-1.1.3.1.pack1.js
- jquery.tabs.pack.js
Css plays a major role in building tab appearance in the page, hence include jquery.tabs.css too ( This can be made custom too)
Step- 2
After that include each tab content in seperate Div but still inside main Div. Note that the href given to the anchor should have the corresponding id in DIV too.
- <div id="container1">
- <ul>
- </ul>
- <div id="tabs1">
- Display something
- </div>
- <div id="tabs2">
- Display something
- </div>
- </div>
Step -3
Finally add following javascript to hook the DIV with jquery Tab plugin.
<script type="text/javascript"> $(function () { $('#container1').tabs(); }); </script>
Done !!!
An Example is
<html> <head runat="server"> <link rel="stylesheet" href="Components/Resources/css/jquery.tabs.css" type="text/css"> </head> <body> <form id="form1" runat="server"> <div id="container1"> <ul> </ul> <div id="tabs1"> Display something </div> <div id="tabs2"> Display something </div> </div> <script type="text/javascript"> $(function () { $('#container1').tabs({ fxSlide: true, fxFade: true, fxSpeed: 'normal' }); }); </script> </form> </body> </html>
No comments:
Post a Comment