mirror of
https://github.com/discourse/discourse.git
synced 2025-01-26 15:00:44 +08:00
12 lines
319 B
JavaScript
12 lines
319 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();
|
|
}
|