Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. {position:fixed; top:90px; left:150 px; z-index:9999; overflow:hidden;}
  2.  
  3. .container {
  4. display: flex;
  5. align-items: center;
  6. justify-content: center;
  7. }
  8.  
  9. var $box = $('#box');
  10.  
  11. var bw = $box.width() / 2;
  12. var bh = $box.height() / 2;
  13.  
  14. var wh = $(window).height() / 2;
  15. var ww = $(window).width() / 2;
  16.  
  17. $box.css({'left': ww-bw, "top": wh-bh})
  18.  
  19. function centerObject(selector) {
  20. var x = $(window).height() - $(selector).height();
  21. var y = $(window).width() - $(selector).width();
  22. $(selector).css("left", y / 2).css("top", x / 2);
  23. };
  24.  
  25. #divX {
  26. position: fixed;
  27. left: 50%;
  28. top: 50%;
  29. width: 100px;
  30. height: 100px;
  31. margin-left: -50px;
  32. margin-top: -50px;
  33. background-color: #0000FF;
  34. }
  35.  
  36. .centered {
  37. position: fixed;
  38. top: 50%;
  39. left: 50%;
  40. margin-top: -50px;
  41. margin-left: -100px;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement