Site branding List effect jquery effect

Source: Internet
Author: User

When the user enters the page, the branding list is the default thin display such as:

Click the View All button below the list of items to display all the brands, while the recommended branding text is highlighted, and the text in the button becomes "Closed view"

How does the JQuery code:

<script type= "Text/javascript" >
$ (document). Ready (function () {
var $cart =$ ("UL li:gt (5): Not (: last)"); Get a branded collection object with an index value greater than 5 (except for the last one)
$cart. Hide (); Hide the jquery object obtained above
var $showBtn =$ (". showbtn"); Get the "View all Brands" button
$showBtn. Click (function () {//Add OnClick event to button
if ($cart. Is (": visible")) {//If the element is displayed
$cart. Hide (); Hide $cart
$showBtn. Text ("View All"); Change the text PS background image with CSS ("Background", "url (path) no-repeat 0 0");
$ ("ul Li"). Removeclass ("active"); Remove highlighting
}else{
$cart. Show (); Show $cart
$showBtn. Text ("Close View"); Change button text
$ ("ul Li"). Filter (": Contains (' Sony '),: Contains (' Samsung ')"). AddClass ("active"); Filter content that contains text to add a highlight style
}
});

});

</script>

Note: Show (): Shows hidden matching elements

Hide (): Hide matching elements

CSS ("", ""): Setting Styles for elements

Text ("string"): Sets the text content of the element

Filter (expr): Filters out a collection of elements that match the specified expression, where expr can be a combination of multiple selectors

Contains (): Contains text elements

AddClass (): Adds the specified class name for the matching element

Removeclass (): Removes the specified class name for the matching element

: visible element Display

Site branding List effect jquery 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.