Method: Nitro::JavascriptHelper#toggleable

Defined in:
lib/nitro/helper/javascript.rb

#toggleable(id, options = {}) ⇒ Object

Clicking the element will make it disappear. If you want it to reappear, you’ll have to call toggle().



198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/nitro/helper/javascript.rb', line 198

def toggleable(id, options = {})
  __append_script_file__ 'js/prototype.js'
  
  behaviour "##{id}", %{
    el.onclick = function() {
      Element.toggle('#{id}');
      return false;
    }
  }
  
  return nil
end