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