Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (21 sloc) 565 Bytes
title slug category tags
Global bootstrap-modal callback
global-bootstrap-modal-callback
web
web, bootstrap, coffeescript

If you are in need of a global callback for bootstrap modals, you can use the fired events.

Simply add the following jQuery in coffeescript:

# coffee
$('body').on 'show', '> .modal', ->
  console.log 'Modal is being shown.'

or plain javascript:

// js
$('body').on('show', '> .modal', function() {
  console.log('Modal is being shown.');
});

Note the > selector, which saves a lot of DOM traversing.