← Back to Main

📚 Interactive Storybook Exercise

Welcome to your storybook coding adventure! You'll learn how to add dropdown menus using JavaScript's appendChild and removeChild methods.

🎯 Your Mission

Add a dropdown menu to every page of the storybook using JavaScript!

🔧 What You'll Learn

📋 Step-by-Step Instructions

Step 1: Start with index.html

  1. Add the dropdown container (look for the TODO comment):
    <div class="dropdown-container">
      <button class="dropdown-button" onclick="toggleDropdown()">⚙️ Story Tools</button>
    </div>
  2. Complete the toggleDropdown() function by filling in the ??? parts:

Step 2: Copy to Other Pages

Once index.html works:

  1. Copy the dropdown container HTML to all other pages
  2. Copy the toggleDropdown() function to all other pages

Step 3: Customize Each Page

🎨 Menu Items to Create

For each page, create these menu items:

Home Page (index.html):
Middle Pages (page2a.html, page2b.html):
Ending Pages (page3a.html, page3b.html):

💡 Helpful Hints

🏆 Bonus Challenges

  1. Add Your Own Menu Item: Create a new button with your own function!
  2. Change the Story: Edit the text to make it your own adventure
  3. Add Sound Effects: Use new Audio('sound.mp3').play() for clicks
  4. Animations: Add CSS transitions to make the dropdown slide in

🔍 Testing Your Work

  1. Open index.html in your browser
  2. Click the "⚙️ Story Tools" button
  3. Make sure the menu appears and disappears when clicked
  4. Test all the menu buttons
  5. Navigate through the story and test each page

📁 File Structure

storybook-student/
├── index.html      ← Start here!
├── page2a.html     ← Forest path
├── page2b.html     ← Mountain path
├── page3a.html     ← Ending A
├── page3b.html     ← Ending B
├── style.css       ← Styling (already done!)
├── README.md       ← Markdown version
└── README.html     ← You're reading this!

🎉 When You're Done

Show your teacher your working storybook! Be ready to explain:

Good luck, and have fun coding your interactive storybook! 🚀


← Back to Main Course Page | Start the Exercise →