jquery simple few code to achieve star comment effect

Source: Internet
Author: User

My previous blog wrote a star review of the original writing, very complex, today through jquery to write a simple star-lit effect, to see the code:

<!DOCTYPE HTML><HTMLLang= "en"><Head>    <MetaCharSet= "UTF-8">    <title>Title</title><style>. Ct-star{Display:Inline-block;margin:0 1px;width:19px;Height:19px;background:URL (img/stars.png) no-repeat;vertical-align:-2px;cursor:Pointer;    }. Ic-star-off{background-position:-39px 0;    }</style></Head><Body>    <spanclass= "Star">        <bclass= "Ct-star Ic-star-off"></b>        <bclass= "Ct-star Ic-star-off"></b>        <bclass= "Ct-star Ic-star-off"></b>        <bclass= "Ct-star Ic-star-off"></b>        <bclass= "Ct-star Ic-star-off"></b>    </span></Body><Scriptsrc= "Js/jquery-1.11.3.min.js"></Script><Script>    $(function(){        $(". Star B"). On ("MouseEnter",function(){            $( This). Removeclass ("Ic-star-off"). Prevall (). Removeclass ("Ic-star-off");        }); $(". Star"). On ("MouseLeave",function(){            $( This). Children (). addclass ("Ic-star-off"); $("B.curr"). Removeclass ("Ic-star-off"). Prevall (). Removeclass ("Ic-star-off");        }); $(". Star B"). On ("Click",function(){            $( This). addclass ("Curr"). Siblings (). Removeclass ("Curr")        })    })</Script></HTML>

Will not show, copy the code yourself can try Oh, be sure to pay attention to the path of the file you refer to! Well, write a simple little example today.

jquery simple few code to achieve star comment 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.