mirror of
https://github.com/discourse/discourse.git
synced 2025-02-09 19:35:30 +08:00
16 lines
309 B
JavaScript
16 lines
309 B
JavaScript
export default function(element) {
|
|
if (element instanceof jQuery) {
|
|
element = element[0];
|
|
}
|
|
|
|
const $window = $(window),
|
|
rect = element.getBoundingClientRect();
|
|
|
|
return (
|
|
rect.top >= 0 &&
|
|
rect.left >= 0 &&
|
|
rect.bottom <= $window.height() &&
|
|
rect.right <= $window.width()
|
|
);
|
|
}
|