Move the mouse over the content display

Source: Internet
Author: User

1, simple display text content:

HTML code:

<!DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd "> <HTMLxmlns= "http://www.w3.org/1999/xhtml"> <Head> <Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" /> <title>To achieve fixed width on both sides, the middle adaptive width-</title>  <Scriptsrc= "Jquery-2.2.3.min.js"></Script>  <Scriptsrc= "Style.js"type= "Text/javascript"></Script></Head>  <Body>       <Divclass= "a">Move the mouse over a</Div>      <Divclass= "B"style= "Display:none;">A shows up.</Div>    </Body> </HTML> 
View Code

JS Code:

       varIshover =false; $(function() {    $(". a"). Hover (function() {Ishover=true; $(". B"). Show (); }, function() {Ishover=false; SetTimeout (function() {            if(!ishover) {                $(". B"). FadeOut (); }        }, 10);    }); $(". B"). Hover (function() {Ishover=true; }, function() {Ishover=false; $(". B"). FadeOut (); });});
View Code

2, with picture change

HTML code:

<Divclass= "Buy_car fl">    <imgsrc= "Images/shopcar.png"class= "Buy_car_img fr"/>    <Divclass= "Buy_car_spec">          <P></P>    </Div></Div>
View Code

JS Code:

$(function() {    //Shopping cart Toggle Picture    varIshover =false    varTimer1 =NULL; $(". Buy_car_img"). Hover (function() {Ishover=true; $(". Buy_car_img"). attr ("src", "images/shopcarhover.png"); $(". Buy_car_spec"). Animate ({height:100        }, 200,function() {            $(". Buy_car p"). HTML ("There is no product in the shopping cart, buy it quickly!") ");    }); }, function() {Ishover=false; $( This). Stop (timer1); Timer1= SetTimeout (function() {            if(!ishover) {                $(". Buy_car_spec"). Animate ({height:0                }, 200,function() {                    $(". Buy_car p"). HTML ("");                }); $(". Buy_car_img"). attr ("src", "images/shopcar.png"); }        }, 200);    }); $(". Buy_car_spec"). Hover (function() {Ishover=true; $(". Buy_car_img"). attr ("src", "images/shopcarhover.png"); $(". Buy_car_spec"). Animate ({height:100        }, 200,function() {            $(". Buy_car p"). HTML ("There is no product in the shopping cart, buy it quickly!") ");    }); }, function() {Ishover=false; $( This). Stop (timer1); Timer1= SetTimeout (function() {            if(!ishover) {                $(". Buy_car_spec"). Animate ({height:0                }, 200,function() {                    $(". Buy_car p"). HTML ("");                }); $(". Buy_car_img"). attr ("src", "images/shopcar.png"); }        }, 200); });
View Code

Move the mouse over the content display

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.