italia2024
Version:
Italia 2024 assets
45 lines (43 loc) • 2.31 kB
JavaScript
(function () {
//float-bottom.js
let flAutos = Array.prototype.slice.call(document.querySelectorAll(':is([class^="fl-none"], [class^="fl-auto"])'));
let flBottomLefts = Array.prototype.slice.call(document.querySelectorAll('[class^="fl-bottomLeft"]'));
let flBottomRights = Array.prototype.slice.call(document.querySelectorAll('[class^="fl-bottomRight"]'));
let spaceLefts = Array.prototype.slice.call(document.querySelectorAll(".spaceLeft"));
let spaceRights = Array.prototype.slice.call(document.querySelectorAll(".spaceRight")); //Arr.NodeList
//ウィンドウロード・リサイズ時のイベント
let fnFloarBottomV3SA = function () {
let timerV3SA = 0;
if (timerV3SA) clearTimeout(timerV3SA);
timerV3SA = setTimeout(() => {
for (let n = 0; n < flBottomLefts.length; n++) {
let flBottomLeft = flBottomLefts[n];
let hgtFlBottomLeft = flBottomLeft.offsetHeight;
let $hgtFlAuto = $(flBottomLeft).next(flAutos).outerHeight();
$(flBottomLeft).prev(spaceLefts).remove();
let crtSpaceLeft = document.createElement('div');
crtSpaceLeft.classList.add('spaceLeft');
flBottomLeft.parentNode.insertBefore(crtSpaceLeft, flBottomLeft);
flBottomLeft.previousElementSibling.style.height = ($hgtFlAuto - hgtFlBottomLeft) + 'px';
flBottomLeft.previousElementSibling.style.float = 'left';
}
for (let n = 0; n < flBottomRights.length; n++) {
let flBottomRight = flBottomRights[n];
let hgtFlBottomRight = flBottomRight.offsetHeight;
let $hgtFlAuto = $(flBottomRight).next(flAutos).outerHeight();
$(flBottomRight).prev(spaceRights).remove();
let crtSpaceRight = document.createElement('div');
crtSpaceRight.classList.add('spaceRight');
flBottomRight.parentNode.insertBefore(crtSpaceRight, flBottomRight);
flBottomRight.previousElementSibling.style.height = ($hgtFlAuto - hgtFlBottomRight) + 'px';
flBottomRight.previousElementSibling.style.float = 'right';
}
}, 0); ///delayTime
};
//ウィンドウロード・リサイズ時のイベント呼び出し登録
'load resize'.split(' ').forEach((events) => {
window.addEventListener(events, function (e) {
fnFloarBottomV3SA();
});
}); ///for.window('load resize')
})(); ///function();