javascript - Fix page shift when opening and closing uib-modal of angular ui bootstrap -


there page shift when opening , closing uib-modal. check https://angular-ui.github.io/bootstrap/#/modal . notice scrollbar disappearance , appearance.

this question asked here (opening angularjs modal causes page shift if scrollbar exists) doesn't has working soultion. solution given set overflow-y body creates vertical scrolling if scrolling not needed.

body{ overflow-y: scroll !important; } 

also visited following links couldn't implement uib-modal. there fix solve issue? in advance.

  1. https://github.com/twbs/bootstrap/issues/9855
  2. https://github.com/angular-ui/bootstrap/issues/3714

shifting may coming because when modal opens add padding body. due bugs don't know padding remains body when modal closed , because of page shifts.

when modal being closed on button click can try -

    $("#modalid").modal('hide');     $('.modal-backdrop').remove();     $('body').removeclass('modal-open');     $('body').css('padding-right', ''); 

it worked in case.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -