Auto-Play Carousel Prompt: Vanilla JS AI Code Example
Prompt
Create an auto-playing image carousel with navigation dots using vanilla JavaScript. Include pause on hover functionality.
CODE PREVIEW
AIとの対話に追加する一言
プロンプトと一緒にコピーして、AIがより正確に意図を汲み取れるようにします
このコードをそのまま使いたいので、CDNリンクも含めた完全なHTMLファイルとして出力してください。
初心者なので、各行にコメントを追加して、何をしているか説明してください。
このコードをWordPressのテーマに組み込む方法も教えてください。
動作確認済みのコードをお願いします。エラーが出る場合の対処法も含めて。
この自動再生カルーセルは3秒ごとに画像を切り替えます。ホバーで一時停止、ドットクリックでナビゲーション。純粋なJavaScriptで構築。
Prompt Overview
This prompt targets front-end developers and designers who need a lightweight, dependency-free image carousel built with plain JavaScript. By specifying vanilla JS, it avoids the overhead of jQuery or third-party libraries, making the result easy to drop into any project regardless of framework. The auto-play feature keeps content moving without user interaction, while the navigation dots give visitors clear visual feedback about their position in the slide sequence.
The pause-on-hover requirement is a thoughtful usability detail — it ensures users can read or examine a slide without the carousel advancing unexpectedly. This kind of prompt is ideal for portfolio pages, product showcases, or hero sections on landing pages. To get the best results, try this prompt with GPT-4o or Claude 3.5 Sonnet, and consider adding variations such as custom transition speed, swipe support for mobile, or keyboard arrow navigation to tailor the component further.
Was this prompt helpful?
Comments
Comments appear after moderation
この記事が役に立ったら投げ銭で応援
Apple Pay / Google Pay / カード (Visa/Mastercard/JCB/Amex) / Link / Alipay / WeChat Pay 対応 · Stripeで安全に決済
開発者が選ぶ最強ツール集
運営者が毎日使っているツール・ガジェット 6選