https://github.com/atomicobject/jquery.persistedtoggle
Toggle the visibility of elements on a page using keyboard shortcuts, persisting the visibility state across requests.
https://github.com/atomicobject/jquery.persistedtoggle
Last synced: 6 months ago
JSON representation
Toggle the visibility of elements on a page using keyboard shortcuts, persisting the visibility state across requests.
- Host: GitHub
- URL: https://github.com/atomicobject/jquery.persistedtoggle
- Owner: atomicobject
- License: mit
- Created: 2011-02-11T13:32:39.000Z (about 15 years ago)
- Default Branch: master
- Last Pushed: 2011-02-12T15:17:30.000Z (about 15 years ago)
- Last Synced: 2025-06-08T22:08:08.846Z (11 months ago)
- Language: JavaScript
- Homepage:
- Size: 154 KB
- Stars: 2
- Watchers: 25
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
============
* [jQuery](http://jquery.com/)
* [jquery.cookie.js](http://plugins.jquery.com/project/Cookie)
* [jquery.jkey.js](http://oscargodson.com/labs/jkey/)
Author
======
* Jason Porritt (jason.porritt@atomicobject.com)
* © 2011 [Atomic Object](http://www.atomicobject.com/)
* More Atomic Object [open source](http://www.atomicobject.com/pages/Software+Commons) projects