Restaurant Introduction (2022-05-25)
Four-page restaurant / franchise brand site (About, News, Products, Stores) with scroll-aware nav, canvas-drawn curved hero and in-view store animations.
Overview
Live Preview
Open the example in a new tab
Page Sections
Interactions
- js/PDWebsitemplate.js window.onscroll: sets #nav class 'toppest' when pageYOffset >= 64px, switches to 'float' when scrolled back.
- setLeftBg() on load / resize: sizes the hero canvas and draws a quadraticCurveTo bump around #page-title's width.
- #nav-show-button toggles the left tab list 'show' / 'hide' (500ms) and swaps the icon between fa-list and fa-arrow-left.
- IntersectionObserver sets class 'inview' on [animation='1'] store cards to trigger stores-index-show-left / -right keyframes.
Dependencies
Styling
_nav styles #nav states (toppest / float / show / hide) with keyframes; _body the hero and canvas; _component the news / product / stores lists and in-view animations; _bottom the footer.
cd target/20220525
npx sass sass/PDWebsiteImitationCss.scss css/PDWebsiteImitationCss.css --no-source-map || exit 1
Techniques
- Canvas 2D path (quadraticCurveTo) recomputed on resize for a curved header edge.
- IntersectionObserver scroll-reveal with alternating left / right keyframes.
- Desktop-first max-width breakpoints 359 / 413 / 479 / 539 / 639 / 799 / 1023px.
- Multi-page static site sharing one stylesheet and script with relative ./*.html links.
External Assets
https://fakeimg.pl/1024/282828/eae0d0/?text=sample
https://pardn.io/image/head.png
https://pardn.io/web-template/image/20220525.jpg