Home > Back-end >  Of the new turn
Of the new turn

Time:09-29



I want to finish this functionality with JQuery
"Http://www.w3.org/TR/html4/strict.dtd" & gt;


<meta HTTP - equiv="content-type" Content="text/HTML. Charset=utf-8 "/& gt;

<style type="text/CSS" & gt;
# li2 {
color: red;
}
Ul {
list-style: none;
}
# div2 {
Background - image: url (" img/star - matrix. GIF ");
Background - repeat: no - repeat;
Height: 16 px;
}
</style>

<script type="text/javascript">
$(function () {


$(" # div2 "). Mouseover (function (event) {
Var x=parseInt (event. OffsetX/16) + 1;//get the mouse in the picture the absolute position of
Var top=5 + num * 16 * 16;

$(" # div2 "). The CSS (" background - position ", "0 px -" + top + "px");

});


$(" # div2 "). A mouseout (function () {
$(" # div2 "). The CSS (" background - position ", "");
});


$(" # div2 "). Click (function (event) {

Var num=parseInt (event. OffsetX/16) + 1;

Var top=num * 16;

$(" # div2 "). The CSS (" background - position ", "0 px -" + top + "px");

$(" # div2 "). The unbind (" mouseout ");//give score and then remove remove event
});


});
</script>


<body>


  • Evaluation: goods & lt;/li>









  • This is the code, but I don't know why the touch doesn't change star, click can change star, for help,

    CodePudding user response:

    Do you want to do is change accordingly when the mouse moves star, for mousemove events, over event is triggered when entering the area
    • Related