How to use jquery to achieve interlaced color effects

Source: Internet
Author: User

How to use jquery to achieve an interlaced color effect:
Interlaced color effect in the site has a large number of applications, especially in similar news lists such functions, for row and row between the distinction there is a great advantage, but also improve the user-friendliness of the site, although it is a small function, but the site's traffic from such a small function points accumulated from the drip. This effect can be implemented using CSS, but since the existing browser is not good enough for CSS3 support, using JS or jquery is a good choice, here's how to use jquery to achieve this effect. The code example is as follows:

<!DOCTYPE HTML><HTML> <Head> <MetaCharSet= "Utf-8"> <Metaname= "Author"content= "http://www.softwhy.com/" /> <title>Ant Tribe</title> <styletype= "Text/css">ul{List-style:None;}</style><Scriptsrc= "Http://libs.baidu.com/jquery/1.9.0/jquery.js"></Script><Scripttype= "Text/javascript">$ (document). Ready (function() {Jquery.changecolor= function(ulid) {varLiset=$ (ulid). Find ("Li");  for (varI= 0; I<liset.length; I+= 2) {Liset.eq (i). CSS ("Background-color", "Green"); }} $.changecolor ("#mytest");})</Script><Body><ulID= "MyTest">  <Li>First line</Li>  <Li>A second line</Li>  <Li>Alternating-changing Li</Li>  <Li>Alternating-changing Li</Li>  <Li>Alternating-changing Li</Li></ul></Body></HTML>

The above code can set the background color of odd rows to green.

The original address is: http://www.softwhy.com/forum.php?mod=viewthread&tid=5790

For more information, refer to: http://www.softwhy.com/jqshili/

How to use jquery to achieve interlaced color effects

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.