Guest User

Untitled

a guest
May 24th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. (function($){
  2. $.fn.extend({
  3. modalPanel: function() {
  4. var overlay = $("<div/>").click(function(e) {
  5. alert("overlay click");
  6. });
  7.  
  8. $(document).keydown(function(e) {
  9. switch(e.keyCode) {
  10. case 27: overlay.remove(); break;
  11. }
  12. });
  13.  
  14. return this.each(function() {
  15. $(this).click(function(e) {
  16. e.preventDefault();
  17.  
  18. $("body").append(overlay);
  19. overlay.fadeIn(200);
  20. });
  21. });
  22. }
  23. });
  24. })(jQuery);
Add Comment
Please, Sign In to add comment