小编Ali*_*min的帖子

如果 bootstrap4 模态位于页面下部,当点击模态内的输入字段时,它会滚动到底部(chrome android)

请看一下这个问题。我有完整的一页简单 html 代码来重现它。有两种模式 - 一种位于页面顶部,另一种位于页面下方。模态框内的输入字段。如果您点击输入字段,它会滚动到最底部,这样我就看不到输入字段。此问题仅出现在底部模态中,而不是顶部模态中。在 ANDROID 上使用 Chrome

这是代码:

  
<!doctype html>
<html lang="en">
<head>
	 
<meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
    <title>Hello, world!</title>
    
    
    
</head>

<body>
      <h4>Hey</h4>
    
      <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal1">
  Open modal
</button>

<!-- The Modal -->
<div class="modal" id="myModal1">
  <div class="modal-dialog">
    <div class="modal-content">

      <!-- Modal Header -->
      <div class="modal-header">
        <h4 class="modal-title">Modal Heading</h4>
        <button type="button" class="close" data-dismiss="modal">&times;</button>
      </div>

      <!-- Modal body -->
      <div class="modal-body">
        Modal body..
           <p>input</p>
        <input type="text"> …
Run Code Online (Sandbox Code Playgroud)

javascript jquery twitter-bootstrap bootstrap-modal bootstrap-4

2
推荐指数
1
解决办法
493
查看次数