Files
2026-01-31 23:16:21 +08:00

29 lines
815 B
JavaScript

/**
* Music Stream landing — minimal interaction
* Smooth scroll, play button state, CTA focus
*/
(function () {
'use strict';
document.querySelectorAll('a[href^="#"]').forEach(function (a) {
a.addEventListener('click', function (e) {
var id = this.getAttribute('href');
if (id === '#') return;
var el = document.querySelector(id);
if (el) {
e.preventDefault();
el.scrollIntoView({ behavior: 'smooth', block: 'start' });
}
});
});
var playBtn = document.querySelector('.player-btn-play');
if (playBtn) {
playBtn.addEventListener('click', function () {
this.classList.toggle('is-playing');
var label = this.getAttribute('aria-label');
this.setAttribute('aria-label', label === 'Play' ? 'Pause' : 'Play');
});
}
})();