Files
homepage/script.js
T
Oliver f73b19c941 Show banner at full width with natural aspect ratio
- Banner is now a real <img> in a full-width grid row (grid-column: 1/-1, grid-row: 2)
  between the card header (row 1) and footer (row 3)
- Cards span all 3 rows with justify-content: space-between
- image width: 100%; height: auto; preserves natural 1584x672 aspect ratio
- pointer-events: none so clicks pass through to cards
- z-index: 0 on banner, z-index: 1 on cards
- Dropdown swaps img src directly
2026-07-01 20:52:08 +00:00

52 lines
1.7 KiB
JavaScript

/* ============================================================
FI-NE & LACUEOR — B2B Partner Portal
Scripts
============================================================ */
(function () {
"use strict";
/* ── Smooth anchor scroll offset for fixed topbar ────────── */
document.querySelectorAll('a[href^="#"]').forEach(function (anchor) {
anchor.addEventListener("click", function (e) {
var target = document.querySelector(this.getAttribute("href"));
if (!target) return;
e.preventDefault();
var offset = 80;
var top =
target.getBoundingClientRect().top +
window.pageYOffset -
offset;
window.scrollTo({ top: top, behavior: "smooth" });
});
});
/* ── Topbar shadow on scroll ─────────────────────────────── */
var topbar = document.querySelector(".topbar");
window.addEventListener(
"scroll",
function () {
if (window.scrollY > 20) {
topbar.style.boxShadow = "0 2px 24px rgba(0,0,0,0.08)";
} else {
topbar.style.boxShadow = "none";
}
},
{ passive: true }
);
/* ── Banner image selector ──────────────────────────────── */
var bannerPicker = document.getElementById("banner-picker");
var bannerImg = document.getElementById("brands-banner-img");
if (bannerPicker && bannerImg) {
bannerPicker.addEventListener("change", function () {
var val = this.value;
bannerImg.style.opacity = "0";
setTimeout(function () {
bannerImg.src = "asset/banner/" + val + ".png";
bannerImg.style.opacity = "1";
}, 200);
});
}
})();