Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/453.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 为移动设备调整页面大小时,引导模式会向下移动页面_Javascript_Html_Css_Twitter Bootstrap - Fatal编程技术网

Javascript 为移动设备调整页面大小时,引导模式会向下移动页面

Javascript 为移动设备调整页面大小时,引导模式会向下移动页面,javascript,html,css,twitter-bootstrap,Javascript,Html,Css,Twitter Bootstrap,我有一个模式,点击我的页面弹出。它在浏览器视图和较小视图中完全居中。在我将页面缩小到手机的那一刻,模态会沿着页面向下移动,我必须滚动才能看到它。我怎样才能解决这个问题 .nx-modal { position: absolute; padding: 20px; background-color: #fff; border-radius: 15px; z-index: 1050; width: 96%; } 是否有任何其他样式指定给替代的模态?例如,像媒体查询?您可以尝试为较小的屏幕添加媒体查

我有一个模式,点击我的页面弹出。它在浏览器视图和较小视图中完全居中。在我将页面缩小到手机的那一刻,模态会沿着页面向下移动,我必须滚动才能看到它。我怎样才能解决这个问题

.nx-modal {
position: absolute;
padding: 20px;
background-color: #fff;
border-radius: 15px;
z-index: 1050;
width: 96%;
}



是否有任何其他样式指定给替代的模态?例如,像媒体查询?您可以尝试为较小的屏幕添加媒体查询,并为您的模式a
top:0px
left:0px
在这种情况下可能会有所帮助

试试这个

 @media only screen and (max-width : 768px) {
 .modal {
  position: fixed;
  top: 0;
  margin:0;
  padding:10px;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1050;
  width: 96%;
  }
}
 @media only screen and (max-width : 768px) {
 .modal {
  position: fixed;
  top: 0;
  margin:0;
  padding:10px;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1050;
  width: 96%;
  }
}