Skip to content

Commit 0ff0737

Browse files
authored
Merge pull request #249 from codeitcodes/patch-1
Patch 1
2 parents caa1db4 + c40bd99 commit 0ff0737

File tree

11 files changed

+825
-560
lines changed

11 files changed

+825
-560
lines changed

bottomfloat.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,20 @@ if (isMobile) {
121121

122122
bottomWrapper.style.setProperty('--window-height', window.innerHeight + 'px');
123123

124-
const landscape = window.matchMedia('(orientation: landscape)');
125-
126-
landscape.addEventListener('change', () => {
124+
window.addEventListener('resize', () => {
125+
126+
// if the window's height changed
127+
if (window.innerHeight != bottomWrapper.prevWindowHeight) {
128+
129+
bottomWrapper.prevWindowHeight = window.innerHeight;
130+
131+
} else {
132+
133+
return;
134+
135+
}
127136

137+
// update bottom float
128138
bottomWrapper.style.setProperty('--window-height', window.innerHeight + 'px');
129139

130140
window.setTimeout(() => {

0 commit comments

Comments
 (0)