Code Explainers
Code explainers tagged #dom-manipulation
javascript
const SWIPE_THRESHOLD = 80; const MAX_TRANSLATE = 120; export function attachSwipeToDismiss(element, onDismiss) {
Building a swipe-to-dismiss gesture in JS
touch-events
gesture-detection
dom-manipulation
Intermediate
10 steps
javascript
class LyricsSync { constructor(audio, container, lines) { this.audio = audio; this.container = container;
Building a synced lyrics highlighter
binary-search
dom-manipulation
event-handling
Intermediate
9 steps
javascript
function makeReorderableList(listEl, onReorder) { let draggedItem = null; listEl.addEventListener('dragstart', (e) => {
Drag-to-reorder lists with the HTML5 drag API
drag-and-drop
event-delegation
dom-manipulation
Intermediate
8 steps