jquery A site brand list effect

Source: Internet
Author: User

jquery a website brand list effect, very classic one case practice, mainly is the practice of jquery method familiar!

Html:

<divclass="Subcategorybox"> <ul> <li><a href="#"> Canon </a><i> (12367) </i></li> <li><a href="#"> Sony </a><i> (12367) </i></li> <li><a href="#"> Samsung </a><i> (12367) </i></li> <li><a href="#"> Nikon </a><i> (12367) </i></li> <li><a href="#"> Panasonic </a><i> (12367) </i></li> <li><a href="#"> Casio </a><i> (12367) </i></li> <li><a href="#"> Fuji </a><i> (57866) </i></li> <li><a href="#"> Kodak </a><i> (57866) </i></li> <li><a href="#"> Pentax </a><i> (57866) </i></li> <li><a href="#"> Ricoh </a><i> (57866) </i></li> <li><a href="#"> Olympus </a><i> (57866) </i></li> <li><a href="#"> BenQ </a><i> (57866) </i></li> <li><a href="#"> Patriots </a><i> (57866) </i></li> <li><a href="#"> Other brand Cameras </a><i> (57866) </i></li> </ul> <divclass="ShowMore Clearfix"> <a href="#"><span> Show All brands </span></a> </div> </div>

Css:

*{margin:0;padding:0;}    . Clearfix{content: ""; clear:both;}    . subcategorybox{        width:600px;border:1px solid #ccc;        overflow:hidden;padding:10px;        position:relative;        top:50%;left:50%;        margin-left:-300px;    }    . Subcategorybox Ul{list-style:none;}    . Subcategorybox ul li{float:left;width:33.3%;        Height:30px;line-height:30px;text-align:center;}    . Subcategorybox ul Li A{text-decoration:none;color: #000;}    . showmore{            width:100%;height:30px;            Text-align:center;        }    . ShowMore a{             Display:inline-block;             width:100px;height:30px;line-height:30px;            border:1px solid #ccc;p adding:2px;        Text-decoration:none;color: #000;}    . promoted{color:red;}

  

JQ:

$ (function () {        var $category =$ ("ul li:gt (6): Not (: last)");//        $category. Hide ();        var $toggleBtn =$ ("Div.showmore>a");        $toggleBtn. Click (function () {            if ($category. Is (": visible")) {                $category. Hide ();                $ (this). FIND ("span"). Text ("Show All Brands");                $ ("ul Li"). Removeclass ("promoted");            } else{                $category. Show ();                $ (this). FIND ("span"). Text ("Thin display Brand");                $ ("ul Li"). Filter (": Contains (' Canon '),: Contains (' Nikon '),: Contains (' Olympus ')"). AddClass ("promoted");            }            return false;        });    

  

jquery A site brand list effect

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.