CSS Scroll-Driven Animations: Progress Bar with Timeline
Prompt
Create a scroll progress indicator with timeline markers using CSS scroll-driven animations. The progress bar should fill as the user scrolls, and timeline markers should highlight at specific scroll positions. No JavaScript required.
CODE PREVIEW
AIとの対話に追加する一言
プロンプトと一緒にコピーして、AIがより正確に意図を汲み取れるようにします
このコードをそのまま使いたいので、CDNリンクも含めた完全なHTMLファイルとして出力してください。
初心者なので、各行にコメントを追加して、何をしているか説明してください。
このコードをWordPressのテーマに組み込む方法も教えてください。
動作確認済みのコードをお願いします。エラーが出る場合の対処法も含めて。
この実装は、JavaScriptなしでスクロールの進行状況によってアニメーションを制御できる最新のCSS機能であるCSSスクロール駆動アニメーションをデモンストレーションします。ページをスクロールするとプログレスバーが埋まり、特定のスクロール位置(25%、50%、75%)でタイムラインマーカーがハイライト表示されます。
主な特徴:
animation-timeline: scroll(root)を使用してアニメーションをスクロール進行状況に連動animation-rangeを使用して特定のスクロール範囲内でマーカーをアクティブ化- スティッキーポジションでスクロール中もプログレスバーを表示
- JavaScript依存なしの純粋なCSSソリューション
- すべての画面サイズで動作するレスポンシブデザイン
ブラウザサポート:実験的Webプラットフォーム機能フラグが有効なChrome 115+またはEdge 115+が必要です。
Prompt Overview
This implementation demonstrates CSS Scroll-Driven Animations, a modern CSS feature that allows animations to be controlled by scroll progress without JavaScript. The progress bar fills as you scroll through the page, and timeline markers highlight at specific scroll positions (25%, 50%, and 75%).
Key features:
- Uses
animation-timeline: scroll(root)to link animations to scroll progress - Markers activate within specific scroll ranges using
animation-range - Sticky positioning keeps the progress bar visible while scrolling
- Pure CSS solution with no JavaScript dependencies
- Responsive design that works on all screen sizes
Browser support: Requires Chrome 115+ or Edge 115+ with the Experimental Web Platform Features flag enabled.
Was this prompt helpful?
Comments
Comments appear after moderation
この記事が役に立ったら投げ銭で応援
Apple Pay / Google Pay / カード (Visa/Mastercard/JCB/Amex) / Link / Alipay / WeChat Pay 対応 · Stripeで安全に決済
開発者が選ぶ最強ツール集
運営者が毎日使っているツール・ガジェット 6選