Reputation: 10809
Using twitter bootstrap I want to conditionally disable the modal windows that it calls. I have this function:
Link like:
<a data-toggle="modal" href="#contact">Contact</a>
JS like:
if (Modernizr.touch){
$("a[data-toggle='modal']").each(function() {
this.href = this.href.replace('/#', '/');
$(this).data('toggle', '');
});
}
I have this script included before bootstrap.min.js is loaded, but still when I click on the links now nothing happens. I think that it's related to the data-toggle attribute, but I have no idea how else to get rid of it.
Thinking of switching it and trying to add the attribute, but I doubt that will work (for the same reason) and I'd prefer not to have to change the markup.
Upvotes: 2
Views: 7700