Skip to content

Commit e049fb2

Browse files
committed
Update bottomfloat.js
1 parent 0d5ab6e commit e049fb2

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

bottomfloat.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -120,19 +120,13 @@ if (isMobile) {
120120
// update on screen resize
121121

122122
bottomWrapper.style.setProperty('--window-height', window.innerHeight + 'px');
123-
124-
bottomWrapper.lastHeight = 0;
125-
126-
window.addEventListener('resize', () => {
127-
128-
if (bottomWrapper.lastHeight === window.innerHeight) {
129-
return;
130-
}
131-
132-
bottomWrapper.lastHeight = window.innerHeight;
123+
124+
const portrait = window.matchMedia('(orientation: portrait)');
125+
126+
portrait.addEventListener('change', (event) => {
133127

134128
bottomWrapper.style.setProperty('--window-height', window.innerHeight + 'px');
135-
129+
136130
});
137131

138132
}

0 commit comments

Comments
 (0)