餐廳介紹 220525
四頁式餐飲加盟品牌網站(品牌介紹、最新消息、餐點介紹、門市據點),含捲動感知導覽列、canvas 曲線主視覺與門市進場動畫。
概要
即時預覽
在新分頁開啟範例
頁面區塊
互動行為
- js/PDWebsitemplate.js window.onscroll:pageYOffset >= 64px 時 #nav 設為 toppest,往回捲動時改為 float。
- setLeftBg() 於 load / resize 執行:調整主視覺 canvas 尺寸,依 #page-title 寬度以 quadraticCurveTo 畫出弧形。
- #nav-show-button 切換左側頁籤列 show / hide(500ms),圖示在 fa-list 與 fa-arrow-left 間切換。
- IntersectionObserver 對 [animation='1'] 門市卡加上 inview,觸發 stores-index-show-left / -right keyframes。
相依資源
樣式
_nav 處理 #nav 狀態(toppest / float / show / hide)與 keyframes;_body 為主視覺與 canvas;_component 為消息/餐點/門市列表與進場動畫;_bottom 為頁尾。
cd target/20220525
npx sass sass/PDWebsiteImitationCss.scss css/PDWebsiteImitationCss.css --no-source-map || exit 1
使用技巧
- 以 Canvas 2D 路徑(quadraticCurveTo)於 resize 重算,繪製弧形頁首邊緣。
- IntersectionObserver 捲動進場,左右交錯 keyframes。
- 桌面優先 max-width 斷點 359 / 413 / 479 / 539 / 639 / 799 / 1023px。
- 多頁靜態網站共用同一份樣式與腳本,以相對路徑 ./*.html 互連。
外部資源
https://fakeimg.pl/1024/282828/eae0d0/?text=sample
https://pardn.io/image/head.png
https://pardn.io/web-template/image/20220525.jpg
相關頁面