Advertisement
jungjnsoul

♡ JUNGJNSOUL'S POPUP PT 1

Apr 16th, 2019
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. <!-- BIG THANKS & CREDITS TO STR-WRS & OCTOMOOSEY FOR THEIR POP-UP TUTORIALS -->
  2.  
  3. <script type="text/javascript"
  4. src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
  5. <script>
  6. $(document).ready(function() {
  7. //
  8. $('a.poplight[href^=#]').click(function() {
  9. var popID = $(this).attr('rel'); //Get Popup Name
  10. var popURL = $(this).attr('href'); //Get Popup href to define size
  11. var query= popURL.split('?');
  12. var dim= query[1].split('&');
  13. var popWidth = dim[0].split('=')[1]; //Gets the first query string value
  14. $('#' + popID).fadeIn().css({ 'width': Number( popWidth ) }).prepend('<a href="#" class="close"></a>');
  15. var popMargTop = ($('#' + popID).height() + 80) / 2;
  16. var popMargLeft = ($('#' + popID).width() + 80) / 2;
  17. //Apply Margin to Popup
  18. $('#' + popID).css({
  19. 'margin-top' : -popMargTop,
  20. 'margin-left' : -popMargLeft
  21. });
  22. $('body').append('<div id="fade"></div>');
  23. $('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn(); //Fade in the fade layer - .css({'filter' : 'alpha(opacity=80)'})
  24. return false;
  25. });
  26. $('a.close, #fade').live('click', function() {
  27. $('#fade , .popup_block').fadeOut(function() {
  28. $('#fade, a.close').remove(); //fade them both out
  29. });
  30. return false;
  31. });
  32. });
  33. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement