Scroll Progress Bar Prompt: AI-Generated Code Example
Prompt
Create a progress bar that fills as you scroll down the page. Should be fixed at top, smooth animation.
CODE PREVIEW
AIとの対話に追加する一言
プロンプトと一緒にコピーして、AIがより正確に意図を汲み取れるようにします
このコードをそのまま使いたいので、CDNリンクも含めた完全なHTMLファイルとして出力してください。
初心者なので、各行にコメントを追加して、何をしているか説明してください。
このコードをWordPressのテーマに組み込む方法も教えてください。
動作確認済みのコードをお願いします。エラーが出る場合の対処法も含めて。
ウェブページ上でどれだけスクロールしたかを視覚的に表示するインジケーターです。下にスクロールするとプログレスバーが左から右へと進み、コンテンツの長さと位置をフィードバックします。
Prompt Overview
This prompt instructs an AI coding assistant to generate a scroll-linked progress bar — a UI element fixed at the top of the page that fills horizontally as the user scrolls toward the bottom. It is a concise, single-request prompt that covers the three essentials: position (fixed top), behavior (scroll-driven fill), and feel (smooth animation). Models like GPT-4o or Claude work well here, typically returning clean HTML, CSS, and a short JavaScript event listener in one pass.
The real-world applications are broad: blog articles, documentation pages, long-form landing pages, and tutorial sites all benefit from this pattern because it gives readers a clear sense of progress. To adapt the prompt, you can specify a color scheme, bar thickness, or ask for a React or Vue component instead of vanilla JavaScript. Adding a phrase like "include a percentage label" or "fade out when at the top" opens up more refined variations without requiring a full rewrite of the original prompt.
Was this prompt helpful?
Comments
Comments appear after moderation
この記事が役に立ったら投げ銭で応援
Apple Pay / Google Pay / カード (Visa/Mastercard/JCB/Amex) / Link / Alipay / WeChat Pay 対応 · Stripeで安全に決済
開発者が選ぶ最強ツール集
運営者が毎日使っているツール・ガジェット 6選