jaysalvat/vegas
Vegas is a jQuery plugin for creating fullscreen backgrounds and slideshow backdrops. Add images, videos, overlays, and transitions to any page element with simple options and events—ideal for hero sections, landing pages, and ambient site-wide backgrounds.
jquery.vegas).
@stack, @push) for JS/CSS inclusion.aria-hidden; critical → ensure keyboard navigation.)app.js or view-specific JS includes jQuery before Vegas.import 'jquery.vegas'; in a view-specific JS file.mix.js() in resources/js/app.js with window.$ checks.@import in a SASS file or CDN.<div id="hero" data-vegas="...">). Data can be passed via Blade variables or hardcoded.<!-- resources/views/layouts/app.blade.php -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery.vegas@1.3.1/dist/vegas.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/jquery.vegas@1.3.1/dist/vegas.css" rel="stylesheet">
npm install jquery jquery.vegas --save
Configure Vite to expose $ globally (if using jQuery).$(document).ready(function() {
$('#hero').vegas({
slides: [
{ src: '/img/slide1.jpg' },
{ src: '/img/slide2.jpg' }
],
delay: 5000
});
});
<div id="hero" data-slides='@json($slides)'></div>
<script>
$('#hero').vegas({ slides: JSON.parse($('#hero').data('slides')) });
</script>
$ or conflict with Vegas’s event handlers.$().vegas('options')).loading="lazy").| Failure | Impact | Mitigation |
|---|---|---|
| jQuery conflict | Plugin breaks | Isolate Vegas in a separate JS context. |
| Vega JS/CSS fails to load | Slideshow missing | Fallback static image. |
| High-res images OOM | Slow rendering | Use srcset or lower-res fallbacks. |
| Abandoned project | Unpatched vulnerabilities | Fork or migrate to maintained library. |
<div id="slideshow" data-slides='...'> and call $('#slideshow').vegas(...)."package.json/composer.json for dependency tracking.How can I help you explore Laravel packages today?