javascript - How to get shown.bs.modal to trigger when the modal uses a remote URL -
the problem
i cannot shown.bs.modal
fire correctly when modal generated passing in remote url.
in following code hidden.bs.modal
consistently work.
the code
$('#my_modal').on("shown.bs.modal", set_up_modal); $('#my_modal').on("hidden.bs.modal", tear_down_modal); $('#my_modal').modal({ remote: target_url }); set_up_modal = function() { console.log('up') }; tear_down_modal = function() { console.log('down') };
what have tried
i have read docs.
i have tried changing .on
read more $('body').on("shown.bs.modal", '#my_modal', saa.set_up_modal);
has produced no change (again hidden.bs.modal
works).
update
i have added console.log($._data( $('#my_modal')[0], "events" ));
, can confirm shown
being bound object, not getting called.
i have tried using show.bs.modal
instead, works need elements visible on screen want them.
found temporary solution pull request here https://github.com/twbs/bootstrap/commit/4b1a6e11326fee97a5ebc194be040086f40f97fb
editing line 81 of modal.js file per below has fixed issue me until pull request made
- that.$element.find('.modal-dialog') // wait modal slide in + that.$element // wait modal slide in
Comments
Post a Comment