StudioTime
StudioTime

Reputation: 23959

Detecting when modal opens - Bootstrap 3

I'm trying to detect when a modal opens so i can set the content height but simply does nothing.

Here's what I'm trying:

$('#bootModal').on('show', function () {
  alert('foo'); // doesn't fire
  $(this).find('.modal-body').css({
    'height':$( window ).height()*0.8
  });
});

Any ideas why it's not detecting the modal opening?

Upvotes: 0

Views: 182

Answers (1)

bakkal
bakkal

Reputation: 55448

In Bootstrap 3, the event is shown.bs.modal not show

shown.bs.modal This event is fired when the modal has been made visible to the user (will wait for CSS transitions to complete). If caused by a click, the clicked element is available as the relatedTarget property of the event.

http://getbootstrap.com/javascript/#modals

Sample: http://plnkr.co/edit/xp3GdIHF8rKLm8h6UhlL?p=preview

Upvotes: 3

Related Questions