Implement compact interface design with hover-expandable controls
- Clean centered header with prominent title - Compact timer in top-right corner with subtle styling - Hover-expandable music controls replacing cluttered header layout - Single music icon () expands to full control panel on hover - Organized controls: play/loop/shuffle, track selection, volume - Modern design with backdrop blur and smooth animations - Maintains all functionality while dramatically reducing visual clutter - Fixed textarea input issues in task management
This commit is contained in:
parent
6963250361
commit
25d855c813
4
game.js
4
game.js
|
|
@ -353,6 +353,10 @@ class TaskChallengeGame {
|
|||
|
||||
// Music controls
|
||||
document.getElementById('music-toggle').addEventListener('click', () => this.toggleMusic());
|
||||
document.getElementById('music-toggle-compact').addEventListener('click', (e) => {
|
||||
e.stopPropagation(); // Prevent event bubbling
|
||||
// The hover panel will show automatically, just indicate it's interactive
|
||||
});
|
||||
document.getElementById('loop-btn').addEventListener('click', () => this.toggleLoop());
|
||||
document.getElementById('shuffle-btn').addEventListener('click', () => this.toggleShuffle());
|
||||
document.getElementById('track-selector').addEventListener('change', (e) => this.changeTrack(parseInt(e.target.value)));
|
||||
|
|
|
|||
46
index.html
46
index.html
|
|
@ -12,27 +12,39 @@
|
|||
<!-- Game Header -->
|
||||
<header class="game-header">
|
||||
<h1>Task Challenge</h1>
|
||||
<div class="timer-container">
|
||||
<span class="timer-label">Time:</span>
|
||||
|
||||
<!-- Compact Timer (top-right corner) -->
|
||||
<div class="timer-compact">
|
||||
<span id="timer" class="timer">00:00</span>
|
||||
<span id="timer-status" class="timer-status"></span>
|
||||
</div>
|
||||
<div class="music-controls">
|
||||
<button id="music-toggle" class="music-btn" title="Play/Pause Music">🎵</button>
|
||||
<button id="loop-btn" class="music-btn" title="Loop Off">🔁</button>
|
||||
<button id="shuffle-btn" class="music-btn" title="Shuffle Off">🔀</button>
|
||||
<select id="track-selector" class="track-dropdown" title="Select Music Track">
|
||||
<option value="0">Colorful Flowers</option>
|
||||
<option value="1">New Beginnings</option>
|
||||
<option value="2">Storm Clouds</option>
|
||||
<option value="3">Brunch For Two</option>
|
||||
</select>
|
||||
<div class="volume-control">
|
||||
<span class="volume-icon">🔊</span>
|
||||
<input type="range" id="volume-slider" min="0" max="100" value="30" class="volume-slider" title="Volume">
|
||||
<span class="volume-percent" id="volume-percent">30%</span>
|
||||
|
||||
<!-- Compact Music Controls (expandable) -->
|
||||
<div class="music-controls-compact">
|
||||
<button id="music-toggle-compact" class="music-icon-btn" title="Music Controls">🎵</button>
|
||||
<div class="music-panel-expanded">
|
||||
<div class="music-row">
|
||||
<button id="music-toggle" class="music-btn-small" title="Play/Pause">▶️</button>
|
||||
<button id="loop-btn" class="music-btn-small" title="Loop">🔁</button>
|
||||
<button id="shuffle-btn" class="music-btn-small" title="Shuffle">🔀</button>
|
||||
</div>
|
||||
<div class="music-row">
|
||||
<select id="track-selector" class="track-dropdown-compact">
|
||||
<option value="0">Colorful Flowers</option>
|
||||
<option value="1">New Beginnings</option>
|
||||
<option value="2">Storm Clouds</option>
|
||||
<option value="3">Brunch For Two</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="music-row">
|
||||
<div class="volume-control-compact">
|
||||
<span class="volume-icon">🔊</span>
|
||||
<input type="range" id="volume-slider" min="0" max="100" value="30" class="volume-slider-compact">
|
||||
<span class="volume-percent" id="volume-percent">30%</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="music-status-compact" id="music-status">Music: Off</div>
|
||||
</div>
|
||||
<span class="music-status" id="music-status">Music: Off</span>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
|
|
|||
216
styles.css
216
styles.css
|
|
@ -35,146 +35,172 @@ body {
|
|||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.game-header h1 {
|
||||
font-size: 2em;
|
||||
margin-bottom: 0;
|
||||
flex: 1;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.timer-container {
|
||||
/* Compact Timer (top-right corner) */
|
||||
.timer-compact {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 80px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
font-size: 0.9em;
|
||||
background: rgba(0, 0, 0, 0.1);
|
||||
padding: 5px 10px;
|
||||
border-radius: 15px;
|
||||
backdrop-filter: blur(5px);
|
||||
}
|
||||
|
||||
.timer {
|
||||
font-weight: bold;
|
||||
font-family: 'Courier New', monospace;
|
||||
}
|
||||
|
||||
.timer-status {
|
||||
font-size: 0.8em;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
/* Compact Music Controls (expandable on hover) */
|
||||
.music-controls-compact {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 20px;
|
||||
}
|
||||
|
||||
.music-icon-btn {
|
||||
background: rgba(0, 0, 0, 0.1);
|
||||
border: none;
|
||||
color: white;
|
||||
font-size: 1.5em;
|
||||
padding: 8px;
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
backdrop-filter: blur(5px);
|
||||
width: 45px;
|
||||
height: 45px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.music-icon-btn:hover {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
transform: scale(1.1);
|
||||
}
|
||||
|
||||
/* Expandable Music Panel */
|
||||
.music-panel-expanded {
|
||||
position: absolute;
|
||||
top: 55px;
|
||||
right: 0;
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
color: #333;
|
||||
border-radius: 10px;
|
||||
padding: 15px;
|
||||
box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
|
||||
backdrop-filter: blur(10px);
|
||||
opacity: 0;
|
||||
visibility: hidden;
|
||||
transform: translateY(-10px);
|
||||
transition: all 0.3s ease;
|
||||
min-width: 200px;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.music-controls-compact:hover .music-panel-expanded {
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.music-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
bottom: -5px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
/* Simple Music Controls */
|
||||
.music-controls {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 15px;
|
||||
flex-wrap: wrap;
|
||||
.music-row:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.music-btn {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border: 2px solid rgba(255, 255, 255, 0.3);
|
||||
color: white;
|
||||
font-size: 1.2em;
|
||||
padding: 8px 12px;
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
min-width: 40px;
|
||||
min-height: 40px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.music-btn:hover {
|
||||
background: rgba(255, 255, 255, 0.3);
|
||||
transform: scale(1.1);
|
||||
}
|
||||
|
||||
.music-btn.playing {
|
||||
background: rgba(255, 215, 0, 0.3);
|
||||
border-color: rgba(255, 215, 0, 0.5);
|
||||
}
|
||||
|
||||
.music-btn.active {
|
||||
background: rgba(0, 255, 127, 0.3);
|
||||
border-color: rgba(0, 255, 127, 0.5);
|
||||
box-shadow: 0 0 10px rgba(0, 255, 127, 0.3);
|
||||
}
|
||||
|
||||
.track-dropdown {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border: 2px solid rgba(255, 255, 255, 0.3);
|
||||
.music-btn-small {
|
||||
background: #007bff;
|
||||
border: none;
|
||||
color: white;
|
||||
font-size: 1em;
|
||||
padding: 6px 10px;
|
||||
border-radius: 6px;
|
||||
border-radius: 5px;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
min-width: 35px;
|
||||
}
|
||||
|
||||
.music-btn-small:hover {
|
||||
background: #0056b3;
|
||||
transform: scale(1.05);
|
||||
}
|
||||
|
||||
.track-dropdown-compact {
|
||||
background: white;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 5px;
|
||||
padding: 5px 8px;
|
||||
font-size: 0.9em;
|
||||
min-width: 140px;
|
||||
width: 100%;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.track-dropdown:focus {
|
||||
outline: none;
|
||||
border-color: rgba(255, 215, 0, 0.5);
|
||||
background: rgba(255, 255, 255, 0.3);
|
||||
}
|
||||
|
||||
.track-dropdown option {
|
||||
background: #333;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.volume-control {
|
||||
.volume-control-compact {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
padding: 6px 12px;
|
||||
border-radius: 20px;
|
||||
border: 2px solid rgba(255, 255, 255, 0.2);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.volume-icon {
|
||||
font-size: 1em;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.volume-slider {
|
||||
width: 80px;
|
||||
.volume-slider-compact {
|
||||
flex: 1;
|
||||
height: 4px;
|
||||
background: rgba(255, 255, 255, 0.3);
|
||||
background: #ddd;
|
||||
border-radius: 2px;
|
||||
outline: none;
|
||||
cursor: pointer;
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
.volume-slider-compact::-webkit-slider-thumb {
|
||||
appearance: none;
|
||||
}
|
||||
|
||||
.volume-slider::-webkit-slider-thumb {
|
||||
-webkit-appearance: none;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background: #ffd700;
|
||||
background: #007bff;
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.3);
|
||||
}
|
||||
|
||||
.volume-slider::-moz-range-thumb {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background: #ffd700;
|
||||
border-radius: 50%;
|
||||
cursor: pointer;
|
||||
border: none;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.3);
|
||||
}
|
||||
|
||||
.volume-percent {
|
||||
font-size: 0.8em;
|
||||
opacity: 0.9;
|
||||
min-width: 30px;
|
||||
font-weight: bold;
|
||||
color: white;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.music-status {
|
||||
color: white;
|
||||
font-size: 0.9em;
|
||||
opacity: 0.9;
|
||||
.music-status-compact {
|
||||
text-align: center;
|
||||
font-size: 0.8em;
|
||||
color: #666;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/* Data Management Controls */
|
||||
|
|
|
|||
Loading…
Reference in New Issue