Simple Example of jquery Tab effect and Dynamic Loading

Source: Internet
Author: User

Simple Example of jquery Tab effect and Dynamic Loading

This article mainly introduces the Tab effect and simple examples of dynamic loading in jquery. If you need it, please refer to it. Hope to help you

I. tab effect display

 

The Code is as follows:

<Html xmlns = "http://www.w3.org/1999/xhtml">

<Title> No title page </title>

<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>

 

<Script src = "js/jquery-1.4.2-vsdoc.js" type = "text/javascript"> </script>

<Style>

Html {font-size: 12px ;}

Body {margin: 50px ;}

Div, ul, li {margin: 0; padding: 0 ;}

# Tab {width: 200px; margin-top: 20px ;}

# Tab li {float: left; height: 20px; line-height: 20px; border: 1px solid #000; list-style: none; padding: 3px 6px ;}

# Tab li. on {background: # 3CF ;}

# Bd div {width: 198px; border: 1px solid #000; height: 100px; text-align: center; line-height: 100px; background: # 3CF ;}

# Links a {margin-right: 10px ;}

</Style>

</Head>

<Body>

<Span id = "links"> <a href = "#"> logon </a> <a href = "#"> Registration </a> </span>

<Ul id = "tab">

<Li class = "on"> logon </li>

<Li> Registration </li>

<Div style = "clear: both;"> </div>

</Ul>

<Div id = "bd">

<Div> logon content </div>

<Div> Registration content </div>

</Div>

<Script type = "text/javascript">

$ (Function (){

$ ("# Bd> div: not (: first)"). hide (); // set the id to the first div under bd, and hide it from a non-first div.

$ ("# Tab li"). mouseover (function () {// triggers a function when the cursor moves over id to the li tag under the tab

Var index = $ ("# tab li"). index (this); // retrieve the index record of the current event in the index

$ (This ). addClass ("on "). siblings (). removeClass ("on"); // Add the style "on" to the current event and remove all styles of the sibling Node

// Siblings () is obtained from the sibling Node

$ ("# Bd> div "). eq (index ). show (). siblings (). hide (); // display the index div under id bd to hide the sibling (for example, $ ("p: eq (1 )") it means "select the second <p> element")

});

// $ ("# Links a"). mouseover (function (){

// Var index = $ ("# links a"). index (this );

// $ ("# Tab li"). eq (index). trigger ("click ");

//});

});

</Script>

</Body>

</Html>

 

 

2. Tab effect and Dynamic Loading

The Code is as follows:

<Html xmlns = "http://www.w3.org/1999/xhtml">

<Head runat = "server">

<Title> </title>

 

<Script src = "js/jquery-1.4.2-vsdoc.js" type = "text/javascript"> </script>

 

<Script type = "text/javascript">

$ (Function (){

$ ("# Bd> div: not (: first)"). hide ();

$ ("# Tab td"). mouseover (function (){

Var index = $ ("# tab td"). index (this );

$ ("# Bd> div"). eq (index). show (). siblings (). hide ();

});

$ ("# Bd a"). click (function (){

Var link = $ ("<td> <a href = 'HTTP: // www.baidu.com '> baidddd </a> </td> ");

Var links = $ ("<div> <a href = 'HTTP: // www.baidu.com '> sdfsdfsd </a> </div> ");

$ ("# Tab"). append (link); // append a link to the id

$ ("# Bd"). append (links); // append links to the bd id

});

});

</Script>

 

<Style type = "text/css">

# Tab li. on

{

Background: # 3CF;

}

</Style>

</Head>

<Body>

<Form id = "form1" runat = "server">

<Table>

<Tr id = "tab">

<Td>

<A href = "http://www.baidu.com"> Baidu </a>

</Td>

<Td>

<A href = "http://www.cnblogs.com"> blog </a>

</Td>

<Td>

<A href = "http://www.hao123.com"> good 123 </a>

</Td>

<Td>

<A href = "http://www.163.com"> 163 </a>

</Td>

</Tr>

</Table>

<Div id = "bd">

<Div>

<Asp: GridView ID = "GridView1" runat = "server" AutoGenerateColumns = "False">

<Columns>

<Asp: TemplateField>

<HeaderTemplate>

 

</HeaderTemplate>

<ItemTemplate>

<% # Eval ("StationName") %>

</ItemTemplate>

</Asp: TemplateField>

<Asp: TemplateField>

<HeaderTemplate>

Asfa

</HeaderTemplate>

<ItemTemplate>

<% # Eval ("StationName") %>

</ItemTemplate>

</Asp: TemplateField>

<Asp: TemplateField>

<HeaderTemplate>

Azsac

</HeaderTemplate>

<ItemTemplate>

<% # Eval ("StationName") %>

</ItemTemplate>

</Asp: TemplateField>

<Asp: TemplateField>

<HeaderTemplate>

Azsac

</HeaderTemplate>

<ItemTemplate>

<A href = "#">

<% # Eval ("StationName") %> </a>

</ItemTemplate>

</Asp: TemplateField>

</Columns>

</Asp: GridView>

</Div>

<Div>

<Asp: GridView ID = "GridView2" runat = "server" AutoGenerateColumns = "False">

<Columns>

<Asp: BoundField DataField = "Business" HeaderText = "Business"/>

<Asp: BoundField DataField = "Status" HeaderText = "Status"/>

<Asp: BoundField DataField = "Certificate" HeaderText = "Certificate"/>

</Columns>

</Asp: GridView>

</Div>

<Div>

<Asp: GridView ID = "GridView3" runat = "server" AutoGenerateColumns = "False">

<Columns>

<Asp: BoundField DataField = "Business" HeaderText = "Business"/>

<Asp: BoundField DataField = "Business" HeaderText = "Business"/>

<Asp: BoundField DataField = "Business" HeaderText = "Business"/>

<Asp: BoundField DataField = "Business" HeaderText = "Business"/>

<Asp: BoundField DataField = "Status" HeaderText = "Status"/>

<Asp: BoundField DataField = "Certificate" HeaderText = "Certificate"/>

</Columns>

</Asp: GridView>

</Div>

<Div>

<Asp: GridView ID = "GridView4" runat = "server" AutoGenerateColumns = "False">

<Columns>

<Asp: BoundField DataField = "Business" HeaderText = "Business"/>

<Asp: BoundField DataField = "Status" HeaderText = "Status"/>

<Asp: BoundField DataField = "Certificate" HeaderText = "Certificate"/>

<Asp: BoundField DataField = "Status" HeaderText = "Status"/>

</Columns>

</Asp: GridView>

</Div>

</Div>

</Form>

</Body>

</Html>

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.