jQuery “blinking highlight” effect on div?

后端 未结 15 1138
囚心锁ツ
囚心锁ツ 2020-12-04 09:24

I\'m looking for a way to do the following.

I add a

to a page, and an ajax callback returns some value. The
is fill
15条回答
  •  囚心锁ツ
    2020-12-04 10:01

    jQuery UI Highlight Effect is what you're looking for.

    $("div").click(function () {
          $(this).effect("highlight", {}, 3000);
    });
    

    The documentation and demo can be found here


    Edit:
    Maybe the jQuery UI Pulsate Effect is more appropriate, see here


    Edit #2:
    To adjust the opacity you could do this:

    $("div").click(function() {
      // do fading 3 times
      for(i=0;i<3;i++) {
        $(this).fadeTo('slow', 0.5).fadeTo('slow', 1.0);
      }
    });
    

    ...so it won't go any lower than 50% opacity.

提交回复
热议问题