Guest User

Untitled

a guest
Jul 23rd, 2015
730
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.js"></script>
  2.  
  3. <script>
  4. $(document).ready(function() {
  5.  
  6. var id = '#dialog';
  7.  
  8. //Get the screen height and width
  9. var maskHeight = $(document).height();
  10. var maskWidth = $(window).width();
  11.  
  12. //Set heigth and width to mask to fill up the whole screen
  13. $('#mask').css({'width':maskWidth,'height':maskHeight});
  14.  
  15. //transition effect
  16. $('#mask').show(1000);
  17. $('#mask').fadeTo("slow",0.5);
  18.  
  19. //Get the window height and width
  20. var winH = $(window).height();
  21. var winW = $(window).width();
  22.  
  23. //Set the popup window to center
  24. $(id).css('top', winH/2-$(id).height()/2);
  25. $(id).css('left', winW/2-$(id).width()/2);
  26.  
  27. //transition effect
  28. $(id).show(2000);
  29.  
  30. //if close button is clicked
  31. $('.window .close').click(function (e) {
  32. //Cancel the link behavior
  33. e.preventDefault();
  34.  
  35. $('#mask').hide();
  36. $('.window').hide();
  37. });
  38.  
  39.  
  40. //if mask is clicked
  41. $('#mask').click(function () {
  42. $(this).hide();
  43. $('.window').hide();
  44. });
  45.  
  46.  
  47.  
  48.  
  49. });
  50.  
  51. </script>
Advertisement
Add Comment
Please, Sign In to add comment