Sticky Header/Footer Implementation for Website

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:
Development stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1215
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    852
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1043
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    823
  • image_bitrix-bitrix-24-1c_fixper_448_0.png
    Website development for FIXPER company
    815

Implementing Sticky Header/Footer on Website

Sticky elements are trivial via position: sticky, but proper implementation accounts for scroll direction, animation performance, safe-area on mobile, and anchor link conflicts.

Basic Sticky Header

Use position sticky with will-change optimization. Add shadow on scroll threshold. Hide on scroll down, show on scroll up for mobile.

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  will-change: transform;
  transition: box-shadow 0.2s ease;
}

.site-header--scrolled {
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

Hide on Scroll Down

Popular pattern: header disappears when scrolling down, appears on scroll up. Useful for space saving on mobile.

const THRESHOLD = 100
const HIDE_AFTER = 50
let scrollStart = 0
let hidden = false

function onScroll() {
  const y = window.scrollY
  const diff = y - lastScrollY

  if (diff > 0) {
    // Scroll down
    if (!hidden && y > THRESHOLD && y - scrollStart > HIDE_AFTER) {
      header.classList.add('site-header--hidden')
      hidden = true
    }
  } else {
    // Scroll up
    if (hidden) {
      header.classList.remove('site-header--hidden')
      hidden = false
      scrollStart = y
    }
  }

  lastScrollY = y
}

React Hook for Sticky Logic

function useStickyHeader(hideOnScrollDown = true) {
  const [state, setState] = useState({
    isScrolled: false,
    isVisible: true,
    scrollY: 0,
  })

  useEffect(() => {
    let ticking = false

    const handler = () => {
      if (ticking) return
      ticking = true

      requestAnimationFrame(() => {
        const y = window.scrollY
        setState(prev => ({
          isScrolled: y > 10,
          isVisible: hideOnScrollDown ? (y < 100 || prev.isVisible) : true,
          scrollY: y,
        }))
        ticking = false
      })
    }

    window.addEventListener('scroll', handler, { passive: true })
    return () => window.removeEventListener('scroll', handler)
  }, [hideOnScrollDown])

  return state
}

Sticky Footer / Bottom Navigation

Use fixed positioning for persistent footer. Apply safe-area-inset for iPhone safe zone.

.bottom-nav {
  position: fixed;
  bottom: 0;
  padding-bottom: env(safe-area-inset-bottom);
}

Anchor Link Conflict

Use scroll-margin-top to account for sticky header covering anchors:

[id] {
  scroll-margin-top: calc(var(--header-height) + 16px);
}

Timeline

Sticky header with scroll shadow — 1–2 hours. With hide-on-scroll and React hook — half day. With bottom nav, safe-area, sticky sidebar — 1 day.