如何使弹出窗口在yii2中水平滚动

问题描述 投票:0回答:1

我在yii2的布局中有此弹出部分。它会在必要时自然向下滚动,但不会水平滚动。我怎样才能使其水平滚动?

<?php

/* @var $this \yii\web\View */
/* @var $content string */

use app\widgets\Alert;
use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
use app\assets\AppAsset;

AppAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="en">
<head>
     <meta charset="utf-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <title><?= Html::encode($this->title) ?></title>
     <!-- Tell the browser to be responsive to screen width -->
     <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
     <link rel="icon" href="images/favicon.ico" type="image/x-icon" />
    <?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>


    <!-- Create modal -->

        <!-- <div class="modal-body"> -->

                <?= $content ?>

        <!-- </div> -->


<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>

此弹出窗口包含在Web /主题/默认/视图/布局中

php yii yii2
1个回答
1
投票

我的工作正常,请在模态div之后使用overflow-y:scroll;

<?php

/* @var $this \yii\web\View */
/* @var $content string */

use app\widgets\Alert;
use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
use app\assets\AppAsset;

AppAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="en">
<head>
     <meta charset="utf-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <title><?= Html::encode($this->title) ?></title>
     <!-- Tell the browser to be responsive to screen width -->
     <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
     <link rel="icon" href="images/favicon.ico" type="image/x-icon" />
    <?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>

    <!-- Create modal -->

        <!-- <div class="modal-body"> -->
            <div style ="overflow-y: scroll;">
                <?= $content ?>
            </div>
        <!-- </div> -->


<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>
© www.soinside.com 2019 - 2024. All rights reserved.