jquery navigation Hover Click and home image Toggle function

Source: Internet
Author: User

<%@ page language= "C #" autoeventwireup= "true" codebehind= "WebForm3.aspx.cs" inherits= "wzgyd. WEBFORM3 "%>

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

<title> Untitled Page </title>
<style type= "Text/css" >
. divlest
{
width:146px;
height:50px;
Float:left;
Border-color:black;
Border-left-style:solid;
border-width:1px;
Text-align:center;
line-height:50px;
Font-weight:bold;
Color:white;
}
. FJ
{
Text-align:center;
width:39px;
Float:right;
Margin-left:auto;
Margin-right:auto;
margin-bottom:0;
height:116px;
}
A
{
Text-decoration:none;
Color:white;
}
</style>

<script src= "Js/jquery-1.8.3.js" type= "Text/javascript" ></script>
<script type= "Text/javascript" >

$ (function () {
var number=0;

> Applies class (Children)
$ (". Fj>input"). Click (function () {

Gets the index value of the input tag assigned to the number variable
number=$ (This). index ();

Switch to determine if the condition is met, perform a background div style toggle
Switch (number) {
Case 0:
$ ("#upcolor"). CSS ("Background-color", "white");
Break
Case 1:
$ ("#upcolor"). CSS ("Background-color", "Red");
Break
Case 2:
$ ("#upcolor"). CSS ("Background-color", "Black");
Break
Case 3:
$ ("#upcolor"). CSS ("Background-color", "Blue");
Break
Case 4:
$ ("#upcolor"). CSS ("Background-color", "lime");
Break
Case 5:
$ ("#upcolor"). CSS ("Background-color", "Aqua");
Break
}
});



var x_inx=0;
$ (". Divlest"). Click (function () {
x_inx=$ (This). index ();//Get the value of the current click
$ (". Divlest"). CSS ("Background-color", "#8f5e23");//Convert all div buttons to initial styles
$ (this). CSS ("Background-color", "#724a1a");//give the current click of the div button to transform the style
});
MouseOver Mouse Hover Events
Mouseout Mouse Out Event
$ (". Divlest"). MouseOver (function () {
$ (this). CSS ("Background-color", "#724a1a");
}). mouseout (function () {
var x=$ (this). index ();
Determine if the value of the mouse-out Div is inconsistent with the value of the mouse click

if (X!=x_inx)
{
Inconsistent change background color
$ (this). CSS ("Background-color", "#8f5e23");
}
})
});



</script>

<body>
<form id= "Form1" runat= "Server" >
<div style= "HEIGHT:769PX; width:100%; Text-align:center; " >
<div style= "width:100%; height:50px; Text-align:center; margin:0 auto; " >
<div class= "Divlest" style= "margin-left:100px;" ><a href= "#" > Home </a></div>
<div class= "divlest" ><a href= "#" > Brand </a></div>
<div class= "divlest" ><a href= "#" > Watches </a></div>
<div class= "divlest" ><a href= "#" > Bags </a></div>
<div class= "divlest" ><a href= "#" > I want consignment </a></div>
<div class= "divlest" ><a href= "#" > Famous maintenance </a></div>
<div class= "Divlest" style= "border-right-style:solid;" ><a href= "#" > Financial cash </a></div>
</div>
<div style= "HEIGHT:451PX; Text-align:center; margin-top:10px; Margin-left:auto; Margin-right:auto; margin-bottom:0; " >
<div id= "Upcolor" style= "HEIGHT:392PX; ">


<div class= "FJ" >
<input type= "Radio" Name= "an" id= "1" checked= "Checked" value= "1"/>
<input type= "Radio" Name= "an" id= "2" value= "2"/>
<input type= "Radio" Name= "an" id= "3" value= "3"/>
<input type= "Radio" Name= "an" id= "4" value= "4"/>
<input type= "Radio" Name= "an" id= "5" value= "5"/>
</div>


</div>

</div>


</div>
</form>
</body>

jquery navigation Hover Click and home image Toggle function

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.