Download tasks/everyplate/environment/reference/clone/static/carousel.js from TIGER-Lab/WebsiteBench: direct link, hf CLI and curl.
- Browser
- Download file 1.01 kB
-
https://huggingface.co/datasets/TIGER-Lab/WebsiteBench/resolve/main/tasks/everyplate/environment/reference/clone/static/carousel.js
- Command line
-
hf download hf://datasets/TIGER-Lab/WebsiteBench/tasks/everyplate/environment/reference/clone/static/carousel.js
-
curl -L -o carousel.js https://huggingface.co/datasets/TIGER-Lab/WebsiteBench/resolve/main/tasks/everyplate/environment/reference/clone/static/carousel.js
1.01 kB
| /* Horizontal carousels. The accordions work without script (each toggle is a real | |
| link the server renders), so this file only adds the arrow scrolling. */ | |
| (function () { | |
| function step(track) { | |
| var card = track.querySelector('li'); | |
| if (!card) return 300; | |
| var styles = window.getComputedStyle(track); | |
| var gap = parseFloat(styles.columnGap || styles.gap || '0') || 0; | |
| return card.getBoundingClientRect().width + gap; | |
| } | |
| function bind(button, delta) { | |
| var name = button.getAttribute('data-carousel-prev') || button.getAttribute('data-carousel-next'); | |
| var track = document.querySelector('[data-carousel="' + name + '"]'); | |
| if (!track) return; | |
| button.addEventListener('click', function () { | |
| track.scrollBy({ left: delta * step(track) * 2, behavior: 'smooth' }); | |
| }); | |
| } | |
| document.querySelectorAll('[data-carousel-prev]').forEach(function (b) { bind(b, -1); }); | |
| document.querySelectorAll('[data-carousel-next]').forEach(function (b) { bind(b, 1); }); | |
| })(); | |