I am just porting a bunch of code from jQuery to DOJO (1.8). I was stumbling upon show/hide of DOM elements (may it be layers or anything else).
Let's say we have a layer that we want to show or hide, without animation. Imagine a Buttonbar that changes on some event, I don't necessarily want to bring in graphical effects all the time.
<div id="myLayer">hide me</div>
In jQuery I would do:
$("#myLayer").show(); // to show
$("#myLayer").hide(); // to hide
which I find very nice and slim. Now porting to DOJO I found that I need to do the following:
require(["dojo/fx/Toggler"], function(Toggler) {
// Create a new Toggler with default options
var toggler = new Toggler({
node: "myLayer",
hideDuration: 0,
showDuration: 0
});
// Hide the node
toggler.hide();
// Show the node
toggler.show();
});
That's 8 lines of code versus 2 lines of code. Am I missing something? Is there any faster way to do a simple hide?
Thanks a lot, Tobi