composer require laraextend/scroll-reveal
php artisan vendor:publish --provider="Laraextend\ScrollReveal\ScrollRevealServiceProvider"
@scrollRevealScripts
<x-scroll-reveal>
<div class="your-content">This will animate on scroll!</div>
</x-scroll-reveal>
Add subtle animations to a hero section:
<section class="hero">
@scrollRevealScripts
<x-scroll-reveal :delay="100" :duration="800" :distance="50">
<h1 class="text-4xl">Welcome to Our Site</h1>
<p class="text-xl">Scroll down to see the magic</p>
</x-scroll-reveal>
</section>
Component Attributes:
<x-scroll-reveal
:delay="300" <!-- Animation delay in ms -->
:duration="1000" <!-- Animation duration -->
:distance="100" <!-- Trigger distance from viewport -->
:once="true" <!-- Disable repeat on re-scroll -->
:animate="['fadeIn', 'zoomIn']" <!-- Multiple animations -->
:threshold="0.1" <!-- Intersection Observer threshold -->
>
Livewire Integration:
<div wire:ignore>
@scrollRevealScripts
<x-scroll-reveal>
{{ $livewireContent }}
</x-scroll-reveal>
</div>
Dynamic Configuration:
// In a controller or service
ScrollReveal::configure(function ($config) {
$config->defaultDelay = 500;
$config->defaultDuration = 1200;
});
wire:ignore for Livewire components to prevent re-renders@scrollRevealScripts in @if(request()->wantsJson()) ... @endif for API routesAnimation Not Triggering:
overflow: hidden on parents)IntersectionObserver is supported (fallback provided)Livewire Conflicts:
wire:ignore to prevent reactivity issueswire:init or wire:loaded events if animations need to trigger after Livewire mountsConfiguration Overrides:
console.log(window.scrollRevealInitialized); // Should be true
console.log(IntersectionObserver); // Verify browser support
<x-scroll-reveal :debug="true">
<!-- Content -->
</x-scroll-reveal>
Custom Animations:
php artisan vendor:publish --tag=scroll-reveal-config
config/scroll-reveal.php under animationsDriver Overrides:
@scrollRevealScripts directiveServer-Side Rendering:
request()->wantsJson() or app()->environment('local') in the directivefadeIn, slideUp) for consistency:delay based on viewport size using Alpine.js or Tailwind responsive classessmooth-scroll packages for better UX when animations trigger on scrollHow can I help you explore Laravel packages today?