Yellow fade effect with JQuery

前端 未结 15 1738
萌比男神i
萌比男神i 2020-11-29 16:23

I would like to implement something similar to 37Signals\'s Yellow Fade effect.

I am using Jquery 1.3.2

The code

(function($) {
   $.fn.yell         


        
15条回答
  •  再見小時候
    2020-11-29 16:52

    function YellowFade(selector){
       $(selector)
          .css('opacity', 0)
          .animate({ backgroundColor: 'Yellow', opacity: 1.0 }, 1000)
          .animate({ backgroundColor: '#ffffff', opacity: 0.0}, 350, function() {
                 this.style.removeAttribute('filter');
                  });
    }
    

    The line this.style.removeAttribute('filter') is for an anti-aliasing bug in IE.

    Now, call YellowFade from wherever, and pass your selector

    YellowFade('#myDivId');
    

    Credit: Phil Haack had a demo showing exactly how to do this. He was doing a demo on JQuery and ASPNet MVC.

    Take a look at this video

    Update: Did you take a look at the video? Forgot to mention this requires the JQuery.Color plugin

提交回复
热议问题