0

I have two modal popups.

Sign in form --> Forgot password form

When someone click forgot password. Current modal closed and forgot password modal appears. Works perfectly. But there was a problem. Sometimes, modal-admin class not apply for the new modal(forgot password) So I use this js script and problem now solved.

  $( document ).ready(function() {
    $('.modal').on('hidden.bs.modal', function () {
      setTimeout(function() {
      if($('.modal').hasClass('in')) {
      $('body').addClass('modal-open');
     }}),400 
    });
  });

But when you switch between modals few times, right side scrollbar takes small time to disappear and I can see small movement in the modal window. This happend random times. This is happening without setTimeout also. I can't imagine why this happens. Any idea?

Janath
  • 1,218
  • 4
  • 26
  • 53

1 Answers1

0

You can use the hide.bs.modal event instead of hidden.bs.modal event so the body class gets added or removed before the modal itself get hidden. May be you are clicking the another modal before the transition is completed.

sethuraman
  • 187
  • 7