引导程序:主体上的模态和变换比例

时间:2018-08-15 14:48:14

标签: css twitter-bootstrap twitter-bootstrap-3 bootstrap-4 bootstrap-modal

我使用引导程序4(但是在引导程序3中存在相同的问题)。

在我的CSS中,我的身体上有一个transform:scale(0.9)

当我打开模式页面时,页面的滚动顶部(并不是真正的滚动,我认为这是css的问题)以及模式和背景位于页面的顶部,而不仅仅是单击按钮的上方...

您可以轻松地重现它:打开一个模式并在DOM编辑器(f12)中在主体上添加transform:scale(1)

<!doctype html>
<html lang="fr">
<head>
  <meta charset="utf-8">
  <title>Titre de la page</title>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
</head>
<body style="transform:scale(1)">
top<br>
down down<br>
down down<br>
down down<br>
down down<br>
down down<br>
down down<br>
down down<br>
down down<br>
down down<br>
down down<br>
down down<br>
down down<br>
down down<br>
down down<br>
down down<br>
down down<br>
down down<br>
down down<br>
down down<br>
down down<br>
down down<br>
down down<br>
down down<br>
down down<br>
down down<br>
down down<br>
down down<br>
down down<br>
down down<br>
down down<br>
down down<br>
down down<br>
  <!-- Button trigger modal -->
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
  Launch demo modal
</button>

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">Modal title</h4>
      </div>
      <div class="modal-body">
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>
</body>
</html>

1 个答案:

答案 0 :(得分:0)

问题是,显然浏览器无法渲染transform:scale()和固定位置...与bootstrap没有直接关系

Positions fixed doesn't work when using -webkit-transform