Skip to content

Instantly share code, notes, and snippets.

@ryngonzalez
Created November 6, 2017 04:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryngonzalez/4b19413b7eeaa5812beafb8235a7ccb9 to your computer and use it in GitHub Desktop.
Save ryngonzalez/4b19413b7eeaa5812beafb8235a7ccb9 to your computer and use it in GitHub Desktop.
var createFocusTrap = require('../../');
var containerOne = document.getElementById('demo-one');
var focusTrapOne = createFocusTrap('#demo-one', {
onDeactivate: function () {
containerOne.className = 'trap';
},
});
document.getElementById('activate-one').addEventListener('click', function () {
focusTrapOne.activate();
containerOne.className = 'trap is-active';
});
document.getElementById('deactivate-one').addEventListener('click', function () {
focusTrapOne.deactivate();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment