I have a nasty problem regarding bootstrap modals on mobile vs desktop.
so the question will be short:
How can I disable bootstrap modal on desktop and enable only for mobile/tablets?
Here is a small js for tests:
There are several ways to check if you are on mobile. You can read more here.
In this example I just used the width of the screen and based on it decided if to show the modal or not:
$('#myModal').on('show.bs.modal', function (e) {
if (window.innerWidth < 800) {
return e.preventDefault();
}
})
Here is the update to your jsfiddle:
http://jsfiddle.net/1aeur58f/28/
You can use responsive utilities classes. In your case you should use .hidden-md or .hidden-md class in modal box
<div class="modal fade hidden-lg hidden-md" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With