Advertisement
Guest User

Untitled

a guest
Jan 16th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.05 KB | None | 0 0
  1. <div class="box">Your Login / splash info goes here</div>
  2.  
  3.  
  4. <div>
  5. This is your original page content.
  6.  
  7. This is the stuff I assume you want to be behind the splash div.
  8. </div>
  9.  
  10. .box{
  11. background: #000000;
  12. color: #666;
  13. opacity: 0;
  14. position:absolute;
  15. top:0;
  16. left:0;
  17. width:100%;
  18. height:100%;
  19. }
  20.  
  21. .splash{
  22. opacity: .9;
  23. padding: 50%;
  24. -webkit-transition: opacity 1s 1s, -webkit-transform 5s;
  25. -moz-transition: opacity 1s 1s, -moz-transform 5s;
  26. -ms-transition: opacity 1s 1s, -ms-transform 5s;
  27. -o-transition: opacity 1s 1s, -o-transform 5s;
  28. transition: opacity 1s 1s, transform 5s;
  29.  
  30. -webkit-transform: translateY(0px);
  31. -moz-transform: translateY(0px);
  32. -ms-transform: translateY(0px);
  33. -o-transform: translateY(0px);
  34. transform: translateY(0px);
  35.  
  36. }
  37.  
  38. setTimeout(function() {
  39. $('.box').addClass('splash')
  40. }, 5);​
  41.  
  42. <div class="splash">
  43. <div class="container">
  44. Username: <input type="text"/> Password: <input type="password"/>
  45. </div>
  46. </div>
  47.  
  48. .splash {
  49. top: 0;
  50. left: 0;
  51. background: black;
  52. color: #888;
  53. }
  54. .splash,
  55. .splash .container {
  56. display: none;
  57. position: absolute;
  58. opacity: 0;
  59. -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
  60. filter: alpha(opacity=0);
  61. }
  62. .splash .container {
  63. position: relative;
  64. top: 50%;
  65. width: 100%;
  66. text-align: center;
  67. }
  68.  
  69. $(document).ready(function(){
  70. var $window = $(window),
  71. $splash = $('.splash'),
  72. $container = $splash.find('.container'),
  73. seconds = 5;
  74.  
  75. var position = function(){
  76. var position = {
  77. top: $window.scrollTop(),
  78. left: $window.scrollLeft(),
  79. height: $window.height(true),
  80. width: $window.width(true)
  81. };
  82.  
  83. $splash.css(position);
  84.  
  85. return position;
  86. };
  87.  
  88. var open = function(){
  89. if (seconds--) {
  90. return setTimeout(open, 1000);
  91. }
  92.  
  93. position();
  94.  
  95. $window.bind('scroll.splashposition resize.splashposition', position);
  96.  
  97. $splash.fadeTo(300, .9, function(){
  98. $container.fadeTo(200, 1);
  99. });
  100. };
  101.  
  102. var close = function(e){
  103. if ($(e.target).is($splash)) {
  104. $window.unbind('scroll.splashposition resize.splashposition');
  105. $container.fadeTo(300, 0, function(){
  106. $splash.fadeTo(200, 0);
  107. });
  108. }
  109. };
  110.  
  111. $container
  112. .css({opacity: 0, display: 'block'});
  113.  
  114. $splash
  115. .css({opacity: 0, display: 'block'})
  116. .click(close);
  117.  
  118. open();
  119. });
  120.  
  121. <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.js"></script>
  122. <script type="text/javascript" src="http://onehackoranother.com/projects/jquery/boxy/javascripts/jquery.boxy.js"></script>
  123.  
  124. <link rel="stylesheet" type="text/css" href="http://onehackoranother.com/projects/jquery/boxy/stylesheets/boxy.css">
  125.  
  126. <p>The splash page will display in 5 second(s).</p>
  127. <!-- Used as the source for the modal window. -->
  128. <div id="splash-message">
  129. <div id="modal-message">
  130. <h1>Title Block</h1>
  131. <p>This is a splash message. This is a link to <a href="http://yahoo.com" target="_blank">Yahoo!</a></p>
  132. <p>Click to dismiss.</p>
  133. </div>
  134. </div>
  135.  
  136. $(document).ready(function(){
  137. var $blackout,
  138. options = {
  139. modal: true,
  140. closeText: 'Dismiss',
  141. show: false
  142. },
  143. message = $('#splash-message').html(),
  144. dialog = new Boxy(message, options),
  145. step = 5;
  146.  
  147. var close = function(){
  148. if (!$blackout) {
  149. $blackout = $('.boxy-modal-blackout');
  150. $blackout.bind('click.detectboxyclose', close);
  151.  
  152. return;
  153. }
  154.  
  155. dialog.toggle();
  156.  
  157. $('.boxy-modal-blackout').unbind('click.detectboxyclose');
  158. };
  159.  
  160. var splash = function(){
  161. if (step < 1) {
  162. dialog.toggle();
  163. close();
  164.  
  165. return;
  166. }
  167.  
  168. step--;
  169. setTimeout(splash, 1000);
  170. };
  171.  
  172. splash();
  173. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement