Skip to content

Commit 0c05225

Browse files
committed
use docEl.clientWidth
1 parent 967673a commit 0c05225

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ https://raw.githack.com/u1ui/parallax.attr/main/tests/test.html
1515
## Ussage:
1616

1717
```js
18-
import 'https://cdn.jsdelivr.net/gh/u1ui/[email protected].3/parallax.min.js';
18+
import 'https://cdn.jsdelivr.net/gh/u1ui/[email protected].4/parallax.min.js';
1919
```
2020

2121
```html

parallax.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ function removeGlobalListeners(){
8080
}
8181

8282
// cache innerHeight, Is that of any use?
83-
let winHeight = innerHeight;
83+
let winHeight = document.documentElement.clientHeight; // was innerHeight // better this?: https://stackoverflow.com/questions/1248081/how-to-get-the-browser-viewport-dimensions
8484
let winWidth = innerWidth;
8585
addEventListener('resize',(e)=>{
86-
winHeight = innerHeight;
86+
winHeight = document.documentElement.clientHeight; // was innerHeight
8787
winWidth = innerWidth;
8888
});
8989

0 commit comments

Comments
 (0)