Matthias,

Thnx, I can't agree more. However its a good solution for now :) I made the limit for everything else except toggle, but I patched it because I though it would improve it a bit. At this moment I am writing an article about the core effect and I was looking into this too. Next week I will have some time, maybe I can make a better solution.

Greets,

Abdur-Rahman

Matthias Platzer wrote:
Hi Abdur-Rahman Advany,

first of all great article, and thanks for adding the limit-feature.

it may seem picky, but it's not perfect yet.
if you use Effect.toggle() on mouseover/mouseout on an element (for example a tooltip) it won't trigger the mouseout event. (close the element again).

a better behavior of Effect.toggle would be:
cancel the running effect, and call the new effect at the point where the old effect currently is in time. (set duration of the new effect to the duration of the old effect)

for a demo see:
http://static.twoday.net/matsblog/stuff/Tooltip/Tooltip.Demo.html


for this example i implemented the following code:
http://static.twoday.net/matsblog/stuff/Tooltip/tooltips.js

open: function(event) {
//...
  var duration = this.options.duration;
  if (this.runningEffect) {
    var queue = Effect.Queues.get(this.options.queue.scope);
    duration = Math.min(new Date().getTime() -
      this.runningEffect.startOn, duration);
    queue.remove(this.runningEffect);
  }
  this.runningEffect =
    Effect[Effect.PAIRS[this.effectName][0]](
      this.popUp, Object.extend(
        Object.extend({}, this.options), {duration: duration}
    ));
//...
},

close: function() {
//...
  var duration = this.options.duration;
  if (this.runningEffect) {
    var queue = Effect.Queues.get(this.options.queue.scope);
    duration = Math.min(new Date().getTime() -
      this.runningEffect.startOn, duration);
    queue.remove(this.runningEffect);
  }
  this.runningEffect =
    Effect[Effect.PAIRS[this.effectName][1]](
      this.popUp, Object.extend(
        Object.extend({}, this.options), {duration: duration}
    ));
//...
}


this is far from elegant, but maybe it's a good starting point for Effect.toggle


matthias



Abdur-Rahman Advany schrieb:
Dirk,

In the latest svn there is a option limit, you can read about it on www.railsdevelopment.com/2006/01/15/effectqueue/. It will limit the 'effects' that can be added to the queue, so it doesn't execute a other queue while processing the first.

Abdur-Rahman Advany

Dirk Eschler wrote:
Hi,

i have a problem with the the SlideDown and SlideUp effects. Since a similiar problem is also visible on the script.aculo.us homepage, i'm going to explain it this way.

- Go to http://script.aculo.us/
- On the main site below "visual effects", click "Advanced options", the sub panel will scroll down. - Hit the close button, and while the panel is still scrolling up, quickly hit the "Advanced options" link again. - Now, when you try to show the sub panel, it won't regain it's full height, but gets a much lower height (probably the one while the effect was interrupted).

The same happens when you interrupt the SlideDown effect by rapidly hitting the "Advanced options" link. I can reproduce it in Firefox, Konqueror and Opera.

Is there a good way of preventing this already, or do i have to care about locking the effect triggers myself?

Best Regards.


_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs



_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to