The focus chart commonly used in malls is simple and practical.

Source: Internet
Author: User

This kind of mall has a lot of online effects, but most of them are plug-ins, or JS is too complicated to write. It seems difficult for children's shoes to learn. This looks simple and easy to understand, please watch out for all your children's shoes and comments and paste the code (For ease of use, you can copy the code and use it without adding anything else ):
Copy codeThe Code is as follows:
<! Doctype html>
<Html lang = "en">
<Head>
<Title> simple and practical results of common mall scrolling </title>
<Script type = "text/javascript" src = "http://jt.875.cn/js/jquery.js"> </script>
<Script type = "text/javascript">
$ (Function (){
Var len = $ (". num> li"). length;
Var index = 0;
Var adTimer;
$ (". Num li"). mouseover (function (){
Index = $ (". num li"). index (this );
ShowImg (index );
}). Eq (0). mouseover ();
// Slide in to stop the animation and slide out to start the animation.
$ ('. Ad'). hover (function (){
ClearInterval (adTimer );
}, Function (){
AdTimer = setInterval (function (){
ShowImg (index)
Index ++;
If (index = len) {index = 0 ;}
},3000 );
}). Trigger ("mouseleave ");
})
// Display different slides by controlling the top
Function showImg (index ){
Var adHeight = $ (". content. ad"). height ();
$ (". Slider"). stop (true, false). animate ({top:-adHeight * index}, 1000 );
$ (". Num li"). removeClass ("on ")
. Eq (index). addClass ("on ");
}
</Script>
<Style type = "text/css">
Ul, li {margin: 0; padding: 0 ;}
. Ad {margin-bottom: 10px; width: 586px; height: 150px; overflow: hidden; position: relative ;}
. Content. slider,. content. num {position: absolute ;}
. Content. slider li {list-style: none; display: inline ;}
. Content. slider img {width: 586px; height: 150px; display: block ;}
. Content. num {right: 5px; bottom: 5px ;}
. Content. num li {float: left; color: # FF7300; text-align: center; line-height: 16px; width: 16px; height: 16px; font-family: Arial; font-size: 12px; cursor: pointer; overflow: hidden; margin: 3px 1px; border: 1px solid # FF7300; background-color: # fff;
}
. Content. num li. on {color: # fff; line-height: 21px; width: 21px; height: 21px; font-size: 16px; margin: 0 1px; border: 0; background-color: # FF7300; font-weight: bold ;}
</Style>
</Head>
<Body>
<Div class = "content">
<Div class = "ad">
<Ul class = "slider">
<Li> </li>
<Li> </li>
<Li> </li>
<Li> </li>
<Li> </li>
</Ul>
<Ul class = "num">
<Li> 1 </li>
<Li> 2 </li>
<Li> 3 </li>
<Li> 4 </li>
<Li> 5 </li>
</Ul>
</Div>
</Div>
</Body>
</Html>

As follows:

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.