Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {position:fixed; top:90px; left:150 px; z-index:9999; overflow:hidden;}
- .container {
- display: flex;
- align-items: center;
- justify-content: center;
- }
- var $box = $('#box');
- var bw = $box.width() / 2;
- var bh = $box.height() / 2;
- var wh = $(window).height() / 2;
- var ww = $(window).width() / 2;
- $box.css({'left': ww-bw, "top": wh-bh})
- function centerObject(selector) {
- var x = $(window).height() - $(selector).height();
- var y = $(window).width() - $(selector).width();
- $(selector).css("left", y / 2).css("top", x / 2);
- };
- #divX {
- position: fixed;
- left: 50%;
- top: 50%;
- width: 100px;
- height: 100px;
- margin-left: -50px;
- margin-top: -50px;
- background-color: #0000FF;
- }
- .centered {
- position: fixed;
- top: 50%;
- left: 50%;
- margin-top: -50px;
- margin-left: -100px;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement