Disable Twitter Bootstrap modal

jquery, twitter-bootstrap

Solution

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();
  }
});

Problem

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.)

Original source