Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2014
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. event.preventDefault()
  2.  
  3. // defining flags
  4. var isCtrl = false;
  5. var isShift = false;
  6. $(document).ready(function () {
  7. // action on key up
  8. $(document).keyup(function (e) {
  9. if (e.which == 17) {
  10. isCtrl = false;
  11. }
  12. if (e.which == 16) {
  13. isShift = false;
  14. }
  15. });
  16.  
  17.  
  18. $(document).keydown(function (e) {
  19. if (e.which == 17) {
  20. isCtrl = true;
  21. }
  22. if (e.which == 16) {
  23. isShift = true;
  24. }
  25.  
  26. if ((e.which == 110 || e.which == 78) && isCtrl) {
  27. e.preventDefault(true);
  28. }
  29. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement