Toggle the visibility of elements on a page using keyboard shortcuts, persisting the visibility state across requests.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
example
.gitignore
LICENSE
README.md
jquery.persistedtoggle.js

README.md

jquery.persistedtoggle.js

Toggle the visibility of elements in a page using keyboard shortcuts, persisting the visibility state across requests.

Examples

Set elements to toggle on 'ctrl+a', default state hidden (default)

$(".admin_controls").persistedtoggle('ctrl+a');

Set elements to toggle on 't', default state shown

$(".search_results).persistedtoggle('t', {'initialState': 'shown'});

Using the onShow and onHide callbacks

$(".form_error, .field_error").persistedtoggle('ctrl+e',
  {
    'initialState': 'hidden',
    'onShow': function() {
      $('.field_error').next("input").addClass("error");
    },
    'onHide': function() {
      $('.field_error').next("input").removeClass("error");
    }
  }
);

Dependencies

Author