-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
16 lines (14 loc) · 731 Bytes
/
script.js
File metadata and controls
16 lines (14 loc) · 731 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
document.addEventListener('DOMContentLoaded', () => {
const toggle = document.getElementById('toggleEmbed');
const jsEmbed = document.getElementById('jsEmbed');
const imageEmbed = document.getElementById('imageEmbed');
const modeLabel = document.getElementById('modeLabel');
if (!toggle || !jsEmbed || !imageEmbed || !modeLabel) return;
toggle.addEventListener('click', () => {
const showingJs = !jsEmbed.classList.contains('hidden');
jsEmbed.classList.toggle('hidden', showingJs);
imageEmbed.classList.toggle('hidden', !showingJs);
modeLabel.textContent = showingJs ? 'Image embed' : 'JavaScript embed';
toggle.textContent = showingJs ? 'Show JavaScript embed' : 'Show image fallback';
});
});