wurde
wurde

Reputation: 2617

Scroll modal on show

I'm using jquery to show my Bootstrap modal, but am unable to scroll it until I manually click inside it.

I've tried focus():

  $('#action-modal-body').focus()

I've tried click():

  $('#action-modal-body').click()

I've even added a delay to account for the modal animation:

  setTimeout(function (){
    $('#action-modal-body').click()
  }, 1000);

Upvotes: 1

Views: 45

Answers (1)

Bhavin Solanki
Bhavin Solanki

Reputation: 4818

Now with bootstrap 3 the events has change an can be achieved like this (plus a smooth animation to the top)

$('#modalIdHere').on('shown.bs.modal', function () {
    $('#modalIdHere').animate({ scrollTop: 100 }, 'slow');
});

Upvotes: 2

Related Questions