Advertisement
xariaaaa

Pop Up Script

Mar 4th, 2015
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. <script>
  2. $(document).ready(function() {
  3. $('a.poplight[href^=#]').click(function() {
  4. var popID = $(this).attr('rel');
  5. var popURL = $(this).attr('href');
  6.  
  7. var query= popURL.split('?');
  8. var dim= query[1].split('&');
  9. var popWidth = dim[0].split('=')[1];
  10.  
  11. $('#' + popID).fadeIn().css({ 'width': Number( popWidth ) }).prepend('<a href="#" class="close"></a>');
  12. var popMargTop = ($('#' + popID).height() + 80) / 2;
  13. var popMargLeft = ($('#' + popID).width() + 80) / 2;
  14. $('#' + popID).css({
  15. 'margin-top' : -popMargTop,
  16. 'margin-left' : -popMargLeft
  17. });
  18. $('body').append('<div id="fade"></div>');
  19. $('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn();
  20. return false;
  21. });
  22. $('a.close, #fade').live('click', function() {
  23. $('#fade , .popup_block').fadeOut(function() {
  24. $('#fade, a.close').remove();
  25. });
  26. return false;
  27. });
  28. });
  29.  
  30. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement