Javascript 这种情况的解决方案是什么?

Javascript 这种情况的解决方案是什么?,javascript,html,css,bootstrap-modal,Javascript,Html,Css,Bootstrap Modal,更改另一个模式时,“模式打开”类从主体中移除,打开的模式不能正确滚动Y轴 这是 请提出解决方案 代码: JS: 它可以帮助你 $(document) .on('shown.bs.modal', '.modal', function () { $(document.body).addClass('modal-open') }); 工作对我来说似乎很好。你能用更多的细节来解释你的问题吗?我有另一个页面,在同一个过程中使用了更多的内容。当点击其中一个按钮时,一个模态打开类被添加到主体

更改另一个模式时,“模式打开”类从主体中移除,打开的模式不能正确滚动Y轴

这是

请提出解决方案

代码:

JS:

它可以帮助你

$(document)
    .on('shown.bs.modal', '.modal', function () {
    $(document.body).addClass('modal-open')
});

工作对我来说似乎很好。你能用更多的细节来解释你的问题吗?我有另一个页面,在同一个过程中使用了更多的内容。当点击其中一个按钮时,一个模态打开类被添加到主体上,整个页面被溢出隐藏。由于此类原因,backpage页面滑动停止,但当您单击登录的注册while opened模式时,主体中打开的模式类将被删除,页面将向下滚动。我想滚动模态激活部分,而不是后身非激活部分。请提供一个有用的问题标题,提示问题的要点。@khushi,同时单击“关闭”按钮“模态打开”类应该被删除你得到答案了吗?在关闭按钮上点击事件,并从正文中删除类
模式打开
。你能在你编写的上述函数上添加该函数吗?
    .btn-primary {
  border: 2px solid #337ab7;
  border-radius: 3px;
  float: left;
  font-size: 18px;
  letter-spacing: 2px;
  margin-bottom: 15px;
  min-width: 300px;
  padding: 15px;
  text-align: center;
  text-transform: uppercase;
  width: 100%;
  text-decoration:none;
}
/* SIGN-IN-MODAL */
/* MODAL-CSS */

#login-modal .modal-dialog {
    width: 350px;
}
#register-modal .modal-dialog {
    width: 350px;
}
#lost-modal .modal-dialog {
    width: 350px;
}


#div-login-msg, #div-lost-msg, #div-register-msg {
  border: 0 none;
  height: 30px;
  line-height: 28px;
  margin-bottom: 15px;
  transition: all 500ms ease-in-out 0s;
}

#div-login-msg.success,
#div-lost-msg.success,
#div-register-msg.success {
    border: 1px solid #68c3a3;
    background-color: #c8f7c5;
}

#div-login-msg.error,
#div-lost-msg.error,
#div-register-msg.error {
    border: 1px solid #eb575b;
    background-color: #ffcad1;
}

#icon-login-msg, #icon-lost-msg, #icon-register-msg {
  background-color: #3b5998;
  color: #fff;
  float: left;
  line-height: 28px;
  margin-right: 5px;
  text-align: center;
  transition: all 500ms ease-in-out 0s;
  width: 30px;
}

#icon-login-msg.success,
#icon-lost-msg.success,
#icon-register-msg.success {
    background-color: #68c3a3 !important;
}

#icon-login-msg.error,
#icon-lost-msg.error,
#icon-register-msg.error {
    background-color: #eb575b !important;
}

#img_logo {
    max-height: 100px;
    max-width: 100px;
}

/* #########################################
   #    override the bootstrap configs     #
   ######################################### */

.modal-backdrop.in {
    filter: alpha(opacity=50);
    opacity: .8;
}

.modal-content {
    background-color: #ececec;
    border: 1px solid #bdc3c7;
    border-radius: 0px;
    outline: 0;
}

.modal-header {
    min-height: 16.43px;
    padding: 15px 15px 15px 15px;
    border-bottom: 0px;
}

.modal-body {
    position: relative;
    padding: 5px 15px 5px 15px;
}

.modal-footer {
    padding: 15px 15px 15px 15px;
    text-align: left;
    border-top: 0px;
}

.checkbox {
    margin-bottom: 0px;
}

.btn {
    border-radius: 0px;
}

.btn:focus,
.btn:active:focus,
.btn.active:focus,
.btn.focus,
.btn:active.focus,
.btn.active.focus {
    outline: none;
}

.btn-lg, .btn-group-lg>.btn {
    border-radius: 0px;
}

.btn-link {
    color: #95a5a6;
}

.btn-link:hover, .btn-link:focus {
    color: #2c3e50;
    text-decoration: none;
}

.glyphicon {
    top: 0px;
}

.form-control {
  border-radius: 0px;
}
#div-login-msg > span {
  font-size: 12px;
}
.pad-btm-10{padding-bottom:10px;}
#login-form label{font-weight:100; font-family:Montserrat; }
#login-modal, #register-modal, #lost-modal{background:rgba(0, 0, 0, 0.7)}
#login-modal .modal-dialog {
  max-width: 380px;
  width: 100%;
  top:10%;
}
#register-form .form-control::-moz-placeholder {
  color: #999;
  opacity: 1;
}

.vfy-btn {
  float: left;
  font-size: 11px;
  margin-top: 10px;
  padding: 2px 25px;
  text-transform: uppercase;
  background:#0097d0; color:#fff;
}
.vfy-btn :hover{color:#fff;}
.cd-signin.lostform {
  float: left;
  margin-bottom: 10px;
  margin-top: 15px;
  width: 100%;
  color:#0dbc42;
}
.myloginpage1{color:#0dbc42;}

.last-btngroup{
    margin-top:10px;
    color:#0dbc42;
}
.last-btngroup a{color:#0dbc42;}
.last-btngroup a:first-child{margin-right:15px;}

/* 
INDIVIDUAL-CAT */
/*  bhoechie tab */
div.bhoechie-tab-container{
  z-index: 10;
  position: fixed;
  right:0;
  top:15px;
  padding: 0 !important;
  margin: 0px;
  background-clip: padding-box;
  opacity: 0.97;
  filter: alpha(opacity=97);
}
div.bhoechie-tab-menu{
  padding-right: 0;
  padding-left: 0;
  padding-bottom: 0;
}
div.bhoechie-tab-menu div.list-group{
  margin-bottom: 0;
}
div.bhoechie-tab-menu div.list-group>a{
  margin-bottom: 0;
}
div.bhoechie-tab-menu div.list-group>a .glyphicon,
div.bhoechie-tab-menu div.list-group>a .fa {
  color: #5A55A3;
}
div.bhoechie-tab-menu div.list-group>a:first-child{
  border-top-right-radius: 0;
  -moz-border-top-right-radius: 0;
}
div.bhoechie-tab-menu div.list-group>a:last-child{
  border-bottom-right-radius: 0;
  -moz-border-bottom-right-radius: 0;
}
div.bhoechie-tab-menu div.list-group>a.active,
div.bhoechie-tab-menu div.list-group>a.active .glyphicon,
div.bhoechie-tab-menu div.list-group>a.active .fa{
  background-color: #5A55A3;
  background-image: #5A55A3;
  color: #ffffff;
}
div.bhoechie-tab-menu div.list-group>a.active:after{
  content: '';
  position: absolute;
  right: 100%;
  top: 50%;
  margin-top: -13px;
  border-bottom: 13px solid transparent;
  border-top: 13px solid transparent;
  border-right: 10px solid #5A55A3;
}

div.bhoechie-tab-content{
  background-color: #ffffff;
  /* border: 1px solid #eeeeee; */
  /*padding-left: 20px;*/
  padding-top: 10px;
}

div.bhoechie-tab>div.bhoechie-tab-content:not(.active) {
    display:none;
}
.gap-top-5s{margin-top:7%;}
   $(".myloginpage").click(function(){
    $('#lost-modal').modal('hide');
    $('#register-modal').modal('hide');
    $("#login-modal").modal('show');
 });
   $(".myloginpage1").click(function(){
    $('#lost-modal').modal('hide');
    $('#login-modal').modal('hide');
    $("#register-modal").modal('show');
 });

   $(".lostform").click(function(){
    $('#register-modal').modal('hide');
    $('#login-modal').modal('hide');
    $("#lost-modal").modal('show');
 });
$(document)
    .on('shown.bs.modal', '.modal', function () {
    $(document.body).addClass('modal-open')
});
$(document).on('hidden.bs.modal', '.modal', function() {
    $(document.body).addClass('modal-open')
});