Simplify pages by focusing in on relevant items, based on values of elements (e.g. select, input, textarea).
This project is maintained by jtwalters
Include jQuery:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
Include plugin's code:
<script src="dist/jquery.focused.min.js"></script>
Call the plugin:
$('#content').focused({
// attr: {string} attribute to use as selector
attr: 'data-focus',
// changeElement: {jQuery object or selector} to bind the change event handler to
changeElement: 'select[name=focus]',
// bindChange: {boolean} whether we should update on change event (if false, only updates on initialization)
bindChange: true,
// value: (optional) {function} to modify the value before using it
value: null,
// afterUpdate: (optional) {function} to run after the value has changed
afterUpdate: function focusTransition() {
$('.focus-wrapper:visible').hide().fadeIn(400)
}
});
Check CONTRIBUTING.md for more information.
MIT License © Joel Walters