Text blinking jQuery

后端 未结 30 1859
我寻月下人不归
我寻月下人不归 2020-11-27 03:23

What is an easy way to make text blinking in jQuery and a way to stop it? Must work for IE, FF and Chrome. Thanks

30条回答
  •  攒了一身酷
    2020-11-27 04:02

    I have written a simple jquery extension for text blink whilst specifying number of times it should blink the text, Hope it helps others.

    //add Blink function to jquery 
    jQuery.fn.extend({
        Blink: function (i) {
            var c = i; if (i===-1 || c-- > 0) $(this).fadeTo("slow", 0.1, function () { $(this).fadeTo("slow", 1, function () { $(this).Blink(c);  }); });
        }
    });
    //Use it like this
    $(".mytext").Blink(2); //Where 2 denotes number of time it should blink.
    //For continuous blink use -1 
    $(".mytext").Blink(-1);
    

提交回复
热议问题