Advertisement
f-ashionabelle

Popup ask box tutorials

Jul 26th, 2014
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.28 KB | None | 0 0
  1. POPUP ASK BOX CODE:
  2.  
  3. 1. Copy and paste the code below under <head> tag.
  4.  
  5. <script type="text/javascript"
  6. src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
  7. <script>
  8. $(document).ready(function() {
  9. //
  10. $('a.poplight[href^=#]').click(function() {
  11. var popID = $(this).attr('rel'); //Get Popup Name
  12. var popURL = $(this).attr('href'); //Get Popup href to define size
  13. var query= popURL.split('?');
  14. var dim= query[1].split('&');
  15. var popWidth = dim[0].split('=')[1]; //Gets the first query string value
  16. $('#' + popID).fadeIn().css({ 'width': Number( popWidth ) }).prepend('<a title="Close this tab" href="#" class="close"><img src="https://cdn1.iconfinder.com/data/icons/bwpx/icons/symbol_multiplication.gif" class="btn_close" alt="Close" /></a>');
  17. var popMargTop = ($('#' + popID).height() + 80) / 2;
  18. var popMargLeft = ($('#' + popID).width() + 80) / 2;
  19. //Apply Margin to Popup
  20. $('#' + popID).css({
  21. 'margin-top' : -popMargTop,
  22. 'margin-left' : -popMargLeft
  23. });
  24. $('body').append('<div id="fade"></div>');
  25. $('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn(); //Fade in the fade layer - .css({'filter' : 'alpha(opacity=80)'})
  26. return false;
  27. });
  28. $('a.close, #fade').live('click', function() {
  29. $('#fade , .popup_block').fadeOut(function() {
  30. $('#fade, a.close').remove(); //fade them both out
  31. });
  32. return false;
  33. });
  34. });
  35. </script>
  36.  
  37. 2. Copy the code below and paste it under <style type=”text/css”> tag.
  38.  
  39. #fade{ /*--Transparent background layer--*/
  40. display: none; /*--hidden by default--*/
  41. background-image: url(http://25.media.tumblr.com/tumblr_mb1ci5hKbh1rt23hno1_400.gif);
  42. position: fixed; left: 0; top: 0;
  43. width: 150%; height: 150%;
  44. opacity: 0.6;
  45. z-index: 100;
  46. }
  47.  
  48. .popup_block{
  49. display: none; /*--hidden by default--*/
  50. background: #fff;
  51. padding: 15px;
  52. padding-bottom: 5px;
  53. border: 3px solid {color:Blogtitle};
  54. overflow: show;
  55. float: left;
  56. text-transform:normal;
  57. font-family:calibri;
  58. font-size: 11px;
  59. line-height:14px;
  60. opacity:1;
  61. position: fixed;
  62. top: 50%; left: 50%;
  63. z-index: 999999;
  64. color: {color:Text};
  65. /*--CSS3 Box Shadows--*/
  66. -moz-box-shadow: 0 0 10px 20px {color:Blogtitle};
  67. -webkit-box-shadow: 0 0 10px 20px {color:Blogtitle};
  68. box-shadow: 10px 10px 80px {color:Blogtitle};
  69. -webkit-transition: all 0.5s ease-in-out;
  70. -moz-transition: all 0.5s ease-in-out;
  71. transition: all 0.5s ease-in-out;
  72. }
  73.  
  74. img.btn_close {
  75. float: right;
  76. margin-top: 5px;
  77. margin-right: 3px;
  78. }
  79.  
  80. /*--Making IE6 Understand Fixed Positioning--*/
  81. *html #fade {
  82. position: absolute;
  83. }
  84. *html .popup_block {
  85. position: absolute;
  86. }
  87.  
  88. ** if you want to customize your popup ask box, just change what you want
  89.  
  90. 3. Copy the code below and paste it under </body> tag.
  91.  
  92. <div id="02" class="popup_block">
  93.  
  94. <center><font size="5" color="#1C1C1C">Ask Me Anything<p></font><iframe frameborder="0" scrolling="yes" width="100%" height="150" src="http://www.tumblr.com/ask_form/YOURURL.tumblr.com" style="background-color:transparent; overflow:hidden;" id="ask_form">
  95. </center></div>
  96. </div></div></div></div></div></div></div></div></div></div>
  97.  
  98. ** make sure you replace the YOURURL with your username!
  99.  
  100. 4. Change the code of your “ask” link to the code below.
  101.  
  102. <a href="#?w=500" rel="02" class="poplight">ask me</a>
  103.  
  104. ** change the “ask me” to the title of what you want
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement