Reputation: 2032
I've taken a look at Bootstrap's JS guidelines, and this code disables the Twitter's Bootstrap modal:
$('#myModal').on('show', function (e) {
if (!data) return e.preventDefault() // stops modal from being shown
})
However, upon clicking the modal, it doesn't open the object (an image, in this case, using Bootstrap Image Gallery: https://github.com/blueimp/Bootstrap-Image-Gallery). It just disables the click function altogether.
I've also tried this snippet to disable the modal gallery:
$(document.body).off('.modal-gallery.data-api')
But it doesn't seem to disable it.
How would I write the jQuery so that the modal gallery is disabled and images open regularly as a link? (Am needing this snippet for a mobile site that will be implemented in the footer, after all scripts have been executed.)
Upvotes: 4
Views: 10714
Reputation: 144
This opens just the image without the bootstrap modal.
div id="blueimp-gallery" class="blueimp-gallery blueimp-gallery-controls" data-use-bootstrap-modal="false"
Upvotes: 0
Reputation: 3833
You can disable the automatic modal binding by removing data-toggle="modal" and bind your click event
$('#mybutton').click(function (e) {
if (data) {
e.preventDefault();
$('#myModal').modal();
}
});
Upvotes: 4