Opened 13 years ago

Closed 12 years ago

#740 closed defect (wontfix)

[lfx] Need a generic toggle function

Reported by: dojo_trac@… Owned by: Bryan Forbes
Priority: high Milestone: 0.9
Component: General Version: 0.2
Keywords: lfx toggle Cc:
Blocked By: Blocking:

Description

A very common use-case for the lfx functions is to toggle a certain element with a certain effect (fade, wipe, etc.). The current toggle code does not support this, rather, it just provides an additional wrapper on top of the lfx functions.

So that means, while I can do dojo.lfx.toggle.wipe.show() or hide(), I can't just do dojo.lfx.toggle.wipe(), which is the common use case I was talking about above.

The function below should do the trick providing a simple toggle function for the types supported in lfx/toggle.js (thanks to ttrenka and dmachi for their help!):

function dojo.lfx.toggle(node, toggleType, duration, easing, callback) {
     var t = toggleType || "plain";
     var action = (node.style.display == "none") ? "show" : "hide";
     dojo.lfx.toggle[t][action](node, duration, easing, callback);
}

Change History (3)

comment:1 Changed 13 years ago by Bryan Forbes

Milestone: 0.3.10.4

comment:2 Changed 13 years ago by dylan

Milestone: 0.40.5

comment:3 Changed 12 years ago by dante

Resolution: wontfix
Status: newclosed

enhancement for 0.4

Note: See TracTickets for help on using tickets.