Skip to content

Commit

Permalink
Fix 100vh to innerHeight
Browse files Browse the repository at this point in the history
  • Loading branch information
otomad committed Jul 26, 2022
1 parent c801ef7 commit 2687ceb
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 16 deletions.
7 changes: 7 additions & 0 deletions basis/innerheight.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(function () {
const declareInnerHeight = () =>
document.documentElement.style.setProperty("--inner-height", window.innerHeight + "px");
declareInnerHeight();
["resize", "load"].forEach(type =>
window.addEventListener(type, declareInnerHeight));
})();
12 changes: 8 additions & 4 deletions math/chobi/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
box-shadow: 0 0 0 0.2rem rgba(173, 181, 189, 0.5);
}

:root {
--inner-height: 100vh;
}

.reset-on-right-float {
margin: 19px 0;
}
Expand Down Expand Up @@ -209,7 +213,7 @@ label {
}

#canvas-part {
height: calc(100vh - 80px - 148px);
height: calc(var(--inner-height) - 80px - 148px);
display: flex;
justify-content: center;
align-items: center;
Expand Down Expand Up @@ -333,7 +337,7 @@ label {

@media (min-width: 992px) {
#canvas-part {
height: calc(100vh - 80px);
height: calc(var(--inner-height) - 80px);
}

#title {
Expand All @@ -342,7 +346,7 @@ label {
}

#filters {
height: calc(100vh - 80px);
height: calc(var(--inner-height) - 80px);
}

.btn-group-04 {
Expand Down Expand Up @@ -374,7 +378,7 @@ label {
html, body {
overflow: hidden;
width: 100vw;
height: 100vh;
height: var(--inner-height);
position: relative;
}

Expand Down
1 change: 1 addition & 0 deletions math/chobi/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<script src="../rgbaster.min.js"></script>
<script src="https://cdn.staticfile.org/jquery-contextmenu/2.7.1/jquery.contextMenu.min.js"></script>
<script src="https://cdn.staticfile.org/jquery-contextmenu/2.7.1/jquery.ui.position.js"></script>
<script src="/basis/innerheight.js"></script>
<link rel="stylesheet" href="https://bootswatch.com/4/flatly/bootstrap.min.css">
<link rel="stylesheet" href="https://bootswatch.com/4/darkly/bootstrap.min.css">
<link rel="stylesheet" href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-core/11.0.0/css/fabric.min.css">
Expand Down
12 changes: 8 additions & 4 deletions math/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ iframe {
padding: 0;
border: 0;
width: 100%;
height: calc(100vh - 60px);
height: calc(var(--inner-height) - 60px);
}

.nav-link {
Expand All @@ -41,14 +41,14 @@ iframe {
display: block;
padding-bottom: 12px;
overflow: auto;
height: calc(100vh - 72px);
height: calc(var(--inner-height) - 72px);
transition: all 250ms ease-in-out, height 0ms !important;
}

@media (pointer: coarse) {
.nav-pills,
#v-pills-tab {
height: calc(100vh - 120px);
height: calc(var(--inner-height) - 120px);
}
}

Expand Down Expand Up @@ -134,7 +134,7 @@ button,
}

iframe {
height: 100vh;
height: var(--inner-height);
}
}

Expand All @@ -152,3 +152,7 @@ button,
:root.dark-font-color * {
color: white !important;
}

:root {
--inner-height: 100vh;
}
1 change: 1 addition & 0 deletions math/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<meta name="description" content="求解各种数学问题">
<script src="https://cdn.staticfile.org/jquery/3.6.0/jquery.min.js"></script>
<script src="https://cdn.staticfile.org/twitter-bootstrap/5.0.2/js/bootstrap.bundle.min.js"></script>
<script src="/basis/innerheight.js"></script>
<link rel="stylesheet" href="https://bootswatch.com/_vendor/bootstrap/dist/css/bootstrap.min.css">
<link id="css" data-theme="bootstrap" rel="stylesheet" href="https://bootswatch.com/_vendor/bootstrap/dist/css/bootstrap.min.css" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">
Expand Down
4 changes: 2 additions & 2 deletions math/turntable/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
<script src="https://cdn.staticfile.org/jquery/3.5.1/jquery.min.js"></script>
<!-- <script src="https://cdn.staticfile.org/popper.js/1.16.1/umd/popper.min.js"></script> -->
<script src="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script src="/basis/innerheight.js"></script>
<link rel="stylesheet" href="https://bootswatch.com/_vendor/bootstrap/dist/css/bootstrap.min.css">
<link id="css" data-theme="bootstrap" rel="stylesheet" href="https://bootswatch.com/_vendor/bootstrap/dist/css/bootstrap.min.css"
crossorigin="anonymous">
<link id="css" data-theme="bootstrap" rel="stylesheet" href="https://bootswatch.com/_vendor/bootstrap/dist/css/bootstrap.min.css" crossorigin="anonymous">
<!-- <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.css"> -->
<style>
@font-face {
Expand Down
14 changes: 8 additions & 6 deletions option.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,16 @@
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<script src="https://cdn.staticfile.org/jquery/3.5.1/jquery.min.js"></script>
<script src="/basis/emmet.min.js"></script>
<script src="/basis/innerheight.js"></script>
<style>
@import url(/basis/css/ease.css);

:root {
--inner-height: 100vh;
--container-margin: 2rem;
--radius: 12px;
--container-width: calc(100vw - 2 * var(--container-margin));
--container-height: calc(100vh - 2 * var(--container-margin));
--container-height: calc(var(--inner-height) - 2 * var(--container-margin));
--waterfall-margin: calc(var(--container-margin) / 2);
}

Expand Down Expand Up @@ -136,7 +138,7 @@
background: var(--page-background);
overflow: hidden;
width: 100vw;
height: 100vh;
height: var(--inner-height);
position: relative;
}

Expand Down Expand Up @@ -651,7 +653,7 @@

.alert > .backdrop {
width: 100vw;
height: 100vh;
height: var(--inner-height);
position: fixed;
left: 0;
top: 0;
Expand Down Expand Up @@ -695,7 +697,7 @@

body>section.point-color {
width: 100vw;
height: 100vh;
height: var(--inner-height);
position: absolute;
overflow: hidden;
}
Expand All @@ -716,7 +718,7 @@
bottom: -27vh;
right: -50vw;
width: 100vw;
height: 100vh;
height: var(--inner-height);
background: radial-gradient(var(--section-color-1), transparent 70%);
}

Expand Down Expand Up @@ -848,7 +850,7 @@

section.animate-block {
position: absolute;
height: 100vh;
height: var(--inner-height);
width: 100vw;
}

Expand Down

0 comments on commit 2687ceb

Please sign in to comment.