1 <!DOCTYPE HTML>2 <HTML>3 <Head>4 <MetaCharSet= "Utf-8" />5 <title>Case Test</title>6 <Linkrel= "stylesheet"href= "Css/all.css" />7 <Scripttype= "Text/javascript"src= "Js/jquery-1.7.2.min.js"></Script>8 <Scripttype= "Text/javascript"src= "Js/all.js"></Script>9 Ten </Head> One A <Body> - <!--End Simulation drop-down box - - <Divclass= "Select"> the <Divclass= "Input_in"> - <inputtype= "text"value= "D.C" /> - </Div> - <Divclass= "City Hide"> + <ul> - <Li>New York1</Li> + <Li>New YORK2</Li> A <Li>New York3</Li> at <Li>New York4</Li> - <Li>New York5</Li> - <Li>New York6</Li> - </ul> - </Div> - </Div> in <!--End Simulation drop-down box - - </Body> to + </HTML>
1 /*Public Style*/2 * {padding:0;margin:0;List-style:None;font-size:14px; }3 . Hide{Display:None; }4 input{Outline:None; }5 6 /*simulate drop-down box*/7 . Select{position:relative;margin:50px 0 0 100px; }8 . Select. Input_in input{width:188px;Height:20px;Line-height:20px;padding:10px 0 10px 10px;Border:1px solid #d6d6d6;cursor:Pointer; }9 . Select. City{position:Absolute;Top:40px; Left:0; }Ten . Select. City UL{width:198px;Border:1px solid #d6d6d6;Border-top:None; } One . Select City ul Li{Padding-left:10px;width:188px;Height:40px;Line-height:40px;cursor:Pointer; }
1$(function(){2 3 //simulate drop-down box4$ ('. Select Input '). On (' click ',function(){5 if($ ('. Select. "). is ('. Hide '))){6$ ('. Select. City '). Removeclass (' Hide ');7}Else{8$ ('. Select. City '). addclass (' Hide ');9 }Ten }) One$ ('. Select Ul li '). On (' click ',function(){ A$ ('. Select Input '). Val ($ ( This). HTML ()); -$ ('. Select. City '). addclass (' Hide '); -$ ('. Select Input '). CSS (' border-bottom ', ' 1px solid $d 6d6d6 '); the }) -$ ('. Select Ul li '). Hover ( - function(){ -$( This). css ({' backgroundcolor ': ' #fd9 ', ' font-size ': ' 18px ')}); +},function(){ -$( This). css ({' backgroundcolor ': ' #fff ', ' font-size ': ' 14px ')}); + } A ) at - - - - -})
Simulate Select drop-down box with Div,ul,input