Fancybox

Copy & paste this code to components/fancybox.blade.php:

<a {{ $attributes->merge(['data-fancybox' => '']) }}>
    {{ $slot }}
</a>

@once
    @push('styles')
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.css" integrity="sha512-H9jrZiiopUdsLpg94A333EfumgUBpO9MdbxStdeITo+KEIMaNfHNvwyjjDJb+ERPaRS6DpyRlKbvPUasNItRyw==" crossorigin="anonymous" />
    @endpush

    @push('scripts')
        <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.js" integrity="sha512-uURl+ZXMBrF4AwGaWmEetzrd+J5/8NRkWAvJx5sbPSSuOb0bZLqf+tOzniObO00BjHa/dD7gub9oCGMLPQHtQA==" crossorigin="anonymous"></script>
        <script>
            $.fancybox.defaults.hash = false
            $.fancybox.defaults.buttons = ['close']
        </script>
    @endpush
@endonce

Usage

<x-fancybox href="{{ $picture->url(2000) }}">
    <x-img :src="$picture" />
</x-fancybox>
Previous topic
← Slider
Next topic
Markdown Mail →