Guest User

Untitled

a guest
Oct 20th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. (function (window, document) {
  2. 'use strict';
  3.  
  4. let className = 'tabbing';
  5.  
  6. let handleFirstTab = function (e) {
  7. if (e.keyCode === 9) {
  8. document.body.classList.add(className);
  9. window.removeEventListener('keydown', handleFirstTab);
  10. window.addEventListener('mousedown', handleMouseDownOnce);
  11. }
  12. }
  13.  
  14. let handleMouseDownOnce = function () {
  15. document.body.classList.remove(className);
  16. window.removeEventListener('mousedown', handleMouseDownOnce);
  17. window.addEventListener('keydown', handleFirstTab);
  18. }
  19.  
  20. window.addEventListener('keydown', handleFirstTab);
  21.  
  22. })(window, document);
Add Comment
Please, Sign In to add comment