![]() Server : LiteSpeed System : Linux premium84.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 User : claqxcrl ( 523) PHP Version : 8.1.32 Disable Function : NONE Directory : /home/claqxcrl/www/js/ |
/** - This is jQuery plugin declaration for element visibility check - @deps: jQuery, - @using: ./js/main.js - @author torbara (https://themeforest.net/user/torbara) - */ (function ($, window, document) { "use strict"; function isVisible(elem) { var coords = elem.getBoundingClientRect(); var windowHeight = document.documentElement.clientHeight; // верхняя граница elem в пределах видимости ИЛИ нижняя граница видима var topVisible = coords.top > 0 && coords.top < windowHeight; var bottomVisible = coords.bottom < windowHeight && coords.bottom > 0; return topVisible || bottomVisible; } $.fn.showVisible = function () { var $el = $(this); $(window).on('scroll', function () { if ($el.attr('data-ready').length === 0) { if (isVisible($el[0])) { $el.trigger('visible'); $el.attr('data-ready', 'true'); } } }); }; })(jQuery, window, document);