laravel-livewire-modals
laravel-livewire-modals copied to clipboard
Support for bootstrap 4
Any chance you could add support for bootstrap 4?
It seems all that needs to change is the javascript that you import:
// modals-bs4.js
let modalsElement = document.getElementById('laravel-livewire-modals');
$(modalsElement).on('hidden.bs.modal', () => {
Livewire.emit('resetModal');
});
Livewire.on('showBootstrapModal', () => {
$(modalsElement).modal('show');
});
Livewire.on('hideModal', () => {
$(modalsElement).modal('hide');
});
Thanks, love the package!
I was having trouble upgrading to bootstrap 5 so I used your script. Worked perfectly. Thank you =)
Where do I put that javascript if you don't mind me asking?
Where do I put that javascript if you don't mind me asking?
Put it in a separate script and import it after 'bootstrap'
.
Also, you have to modify the modal template a bit to prevent close on the escape key,
- publish the view (if you've not already done)
php artisan vendor:publish --tag=laravel-livewire-modals:views
- modify data attributes to fit the BS v4 (remove extra bs) in
resources/views/vendor/laravel-livewire-modals/modals.blade.php
eg: data-bs-backdrop="static"
to data-backdrop="static"