Javascript 如何在Yii2高级模板上添加jumbotron背景图像效果

Javascript 如何在Yii2高级模板上添加jumbotron背景图像效果,javascript,php,css,twitter-bootstrap-3,yii2-advanced-app,Javascript,Php,Css,Twitter Bootstrap 3,Yii2 Advanced App,我试图从这篇文章中的Skelly用户那里获得如下效果: 这就是我现在所做的: AppAsset.php: <?php /** * @link http://www.yiiframework.com/ * @copyright Copyright (c) 2008 Yii Software LLC * @license http://www.yiiframework.com/license/ */ namespace frontend\assets; use yii\web\A

我试图从这篇文章中的
Skelly
用户那里获得如下效果:

这就是我现在所做的:

AppAsset.php:

<?php
/**
 * @link http://www.yiiframework.com/
 * @copyright Copyright (c) 2008 Yii Software LLC
 * @license http://www.yiiframework.com/license/
 */

namespace frontend\assets;

use yii\web\AssetBundle;

/**
 * @author Qiang Xue <qiang.xue@gmail.com>
 * @since 2.0
 */
class AppAsset extends AssetBundle
{
    public $basePath = '@webroot';
    public $baseUrl = '@web';
    public $css = [
        'css/site.css',
    ];
    public $js = [
        'javascript/jumboHeight.js'
    ];
    public $depends = [
        'yii\web\YiiAsset',
        'yii\bootstrap\BootstrapAsset',
    ];
}
html,
body {
    height: 100%;
}

.wrap {
    min-height: 100%;
    height: auto;
    margin: 0 auto -60px;
    padding: 0 0 60px;
}

.wrap > .container {
    padding: 70px 15px 20px;
}

.footer {
    height: 60px;
    background-color: #f5f5f5;
    border-top: 1px solid #ddd;
    padding-top: 20px;
}

.jumbotron {
    text-align: center;
    height: 350px;
    color: white;
    text-shadow: #444 0 1px 1px;
    background:transparent;
}

.jumbotron .btn {
    font-size: 21px;
    padding: 14px 24px;
}

.not-set {
    color: #c55;
    font-style: italic;
}

/* add sorting icons to gridview sort links */
a.asc:after, a.desc:after {
    position: relative;
    top: 1px;
    display: inline-block;
    font-family: 'Glyphicons Halflings';
    font-style: normal;
    font-weight: normal;
    line-height: 1;
    padding-left: 5px;
}

a.asc:after {
    content: /*"\e113"*/ "\e151";
}

a.desc:after {
    content: /*"\e114"*/ "\e152";
}

.sort-numerical a.asc:after {
    content: "\e153";
}

.sort-numerical a.desc:after {
    content: "\e154";
}

.sort-ordinal a.asc:after {
    content: "\e155";
}

.sort-ordinal a.desc:after {
    content: "\e156";
}

.grid-view th {
    white-space: nowrap;
}

.hint-block {
    display: block;
    margin-top: 5px;
    color: #999;
}

.error-summary {
    color: #a94442;
    background: #fdf7f7;
    border-left: 3px solid #eed3d7;
    padding: 10px 20px;
    margin: 0 0 15px 0;
}

.bg {
    background: url('/frontend/web/images/header.jpg') no-repeat center center;
    position: fixed;
    width: 100%;
    height: 350px; /*same height as jumbotron */
    top:0;
    left:0;
    z-index: -1;
}
这是我的
Index.php

<div class="site-index">
    <div class="bg"></div>
    <div class="jumbotron">
        <div class="container">
            <blockquote class="pull-left">
                <header class="pull-left text-primary">News</header>
                <br>
                <comment>Setting up Website</comment>
            </blockquote>
            <br>

            <h1>Congratulations!</h1>

            <p class="lead">You have successfully created your Yii-powered application.</p>

            <p><a class="btn btn-lg btn-success" href="http://localhost/yii/frontend/web/index.php?r=projects%2Fcreate">Starting
                    a Project !</a></p>
        </div>
    </div>
但是在jombotron上显示图片有一个问题,下面是它的外观:

那么,问题是什么


我将感谢您的任何建议。

请尝试以下代码:

.jumbotron {
    background-color: transparent !important;
    background-image: url("image.jpg") !important; 
}

请尝试以下代码:

.jumbotron {
    background-color: transparent !important;
    background-image: url("image.jpg") !important; 
}

不行!:-?事实上,图片没有显示。有什么问题吗?不起作用!:-?事实上,这张照片没有显示。有什么问题吗?