Guest User

Untitled

a guest
Aug 16th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. always keep the window in the center when move the scroll bar
  2. <style>
  3. #Window {
  4. display: none;
  5. text-align: center;
  6. border: 1px solid #333;
  7. position:absolute;
  8. width: 200px;
  9. height: 80px;
  10. z-index:9999;
  11. background:#fff;
  12. border-radius: 5px;
  13. padding: 10px;
  14. }
  15. </style>
  16.  
  17. <script>
  18. $("#window").css('top', 200);
  19. $("#window").css('left', winW/2- $("#window").width());
  20. $(window).scroll(function () {
  21.  
  22. var winH = $(window).height();
  23. setTimeout( function(){
  24. $('#alertWindow').animate({'top':winH/2-$("#window").height()/2},200);
  25. }, 1000);
  26. });
  27. </script>
  28.  
  29. <div id="window">this is scroll window</div>
  30.  
  31. $( ".myDialogWindow" ).dialog( "option", "position", 'center' );
Add Comment
Please, Sign In to add comment