Nice effect... although I'm more inclined to call it a control or widget than effect. Perhaps you can also make it support passing in an array of values to allow for non-ajax updates. For instance, "new Effect.Updater (el, {newContentArray: ['foo', 'bar', 'blah'], queue: 'end'});"


On 7/18/06, Fabian Lange <[EMAIL PROTECTED] > wrote:
Hi,
perhaps I am overseeing this but it seems that there is no easy way to set
up a queue with two effects (fade and appear) and in between exchange the
content.
So I have an application with static layout and just want to animate the
exchange of the content from the main div.

So I wrote my own effect. The nice thing is that this is now queue able.

Effect.Updater = Class.create();
Object.extend(Object.extend(Effect.Updater.prototype,
Effect.Base.prototype), {
  initialize: function(element) {
    this.element = $(element);
    var options = Object.extend ({
      duration: 0.001,
      newContent: ''
    }, arguments[1] || {});
    this.start(options);
  },
  loop: function(timePos) {
    if(timePos >= this.startOn) {
      Element.update(this.element ,this.options.newContent);
      this.cancel();
      return;
    }
  }
});

So I can now put this to the method I pass to onComplete of Ajax.Request

function reload_content(ajax){
  el = $('content');
  new Effect.Fade(el,{queue:'front'});
  new Effect.Updater(el,{newContent:ajax.responseText,queue:'end'});
  new Effect.Appear(el,{queue:'end'});
}

Is there a better way to accomplish this? If not, then I might contribute
this when I figure out how the version control system works :)


Br
Fabian

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to