Hide
Writing an article is easy - try our reStructured Text demo Join Siafoo Now or Learn More

Toggle method for Element class Atom Feed 0

In Brief Toggles element off and on, between display:none and display:''.... more
# 's
 1// Copyright 2008 Siafoo.net
2// BSD License
3
4Element.extend({
5 toggle: function(t){
6 if (t==0)
7 this.setStyle('display','none')
8 else if (t==1)
9 this.setStyle('display','')
10 else if (this.getStyle('display')!='none')
11 this.setStyle('display','none')
12 else
13 this.setStyle('display','')
14 }
15})

Toggles element off and on, between display:none and display:''.

Pass 0 to turn off, 1 to turn on, or nothing to toggle.

Requires mootools.