SoFunction
Updated on 2025-03-07

jQuery realizes the special effects of positive reviews and bad reviews


$(function(){
    $(".maxdiv div").bind("hover",function(){
$(this).attr("style","background:red");//The current div plus style="background:red";
$("div:last").prevAll().attr("style","background:red");//Add styles to all;
$(this).nextAll().attr("style","");//All styles after the current div are "";
var dsize=$("div [style ='background:red']").size();//Get the number of all backgrounds containing style="background:red";
        if(dsize==1)
        {
$('span').text("poor");
        }
        else if(dsize==2)
        {
$('span').text("poor");
        }
        else if(dsize==3)
        {
$('span').text("General");
        }
        else if(dsize==4)
        {
$('span').text("good");
        }
        else if(dsize==5)
        {
$('span').text("very good");
        }
    });
});