Advertisement
Guest User

Untitled

a guest
Sep 27th, 2011
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. $(document).ready(function() {
  2.  
  3. //select all the a tag with name equal to modal
  4. $('a[name=modal]').click(function(e) {
  5. //Cancel the link behavior
  6. e.preventDefault();
  7. //Get the A tag
  8. var id = $(this).attr('href');
  9.  
  10. //Get the screen height and width
  11. var maskHeight = $(document).height();
  12. var maskWidth = $(window).width();
  13.  
  14. //Set height and width to mask to fill up the whole screen
  15. $('#mask').css({'width':maskWidth,'height':maskHeight});
  16.  
  17. //transition effect
  18. $('#mask').fadeIn(1000);
  19. $('#mask').fadeTo("slow",0.8);
  20.  
  21. //Get the window height and width
  22. var winH = $(window).height();
  23. var winW = $(window).width();
  24.  
  25. //Set the popup window to center
  26. $(id).css('top', winH/2-$(id).height()/2);
  27. $(id).css('left', winW/2-$(id).width()/2);
  28.  
  29. //transition effect
  30. $(id).fadeIn(2000);
  31.  
  32. });
  33.  
  34. //if close button is clicked
  35. $('.window .close').click(function (e) {
  36. //Cancel the link behavior
  37. e.preventDefault();
  38. $('#mask, .window').hide();
  39. player.stopVideo();
  40. });
  41.  
  42. //if mask is clicked
  43. $('#mask').click(function () {
  44. $(this).hide();
  45. $('.window').hide();
  46. player.stopVideo();
  47. });
  48.  
  49. });
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement