Files
homepage/script.js
T
Oliver 65a7d4aaee Fix: show banner full height + reliable dropdown
- Increased brand-card-gap min-height to 500px (desktop) so
  the full background image is visible (509px at 1200px grid width)
- Responsive: 400px at 960px, 240px at 600px
- Dropped grid-row spanning approach; back to CSS background-image
  on .brands-grid with background-size: 100% auto
- Dropdown sets backgroundImage directly on .brands-grid via
  style.backgroundImage — no setTimeout, no opacity animation,
  no async timing issues
2026-07-01 21:19:07 +00:00

49 lines
1.6 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 brandsGrid = document.querySelector(".brands-grid");
if (bannerPicker && brandsGrid) {
bannerPicker.addEventListener("change", function () {
var val = this.value;
brandsGrid.style.backgroundImage =
"url(asset/banner/" + val + ".png)";
});
}
})();