fix(browser-extension): issue #630
This commit is contained in:
parent
e3e9cbf5c5
commit
293c25578e
@ -191,13 +191,16 @@ function getHostname() {
|
|||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
function isInViewport(element) {
|
function isInViewport(element) {
|
||||||
|
const styles = window.getComputedStyle(element);
|
||||||
const height = window.innerHeight || document.documentElement.clientHeight;
|
const height = window.innerHeight || document.documentElement.clientHeight;
|
||||||
const position = element.getBoundingClientRect();
|
const position = element.getBoundingClientRect();
|
||||||
const scroll = window.scrollY;
|
const scroll = window.scrollY;
|
||||||
|
const transitioning = styles.transitionDuration !== '0s';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
position.bottom === position.top ||
|
position.bottom === position.top ||
|
||||||
(scroll + position.top <= scroll + height && scroll + position.bottom >= scroll)
|
(scroll + position.top <= scroll + height && scroll + position.bottom >= scroll) ||
|
||||||
|
transitioning
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user