Jquery selector

saw a code on the Internet:

$({property: 0}).animate({property: 100}, {
    duration: 1000,
    step: function() {
        var percentage = Math.round(this.property);

        $("-sharpprogress").css("width",  percentage+"%");
        if(percentage == 100) {
            $("-sharpprogress").addClass("done");//
        }
    }
});

I don"t understand $({property: 0}). Is property an attribute of css3? Hope to pass by under the guidance of the god, thank you!

Jul.14,2022

$({property: 0}) is to convert a normal object {property: 0} into a jquery object so that you can use the animate animation function of jquery. The point is that the function animate can animate from one attribute value to another. As for the attribute name property, you can define it freely. For example, the following code will output a progress value of 0 to 100 in 1 second.

$({a: 0}).animate({a: 100}, {
    duration: 1000,
    step: function() {
        console.log(this.a)
    }
});
Menu