如何使<li>像视差一样滚动?

时间:2016-08-30 08:35:12

标签: html parallax

使'li'标签也像视差一样滚动的最佳方法是什么?

<div class="wrapper bg-4">
        <div class="container">
            <div class="row">
                <div class="col-sm-7 invest">
                    <h3>Invest in Azerbaijan</h3>
                    <ul>
                        <li>Total Area:  86,600 km2</li>
                        <li>Water (%): 1.6</li>
                        <li>GDP   (PPP):   $168.4 billion</li>
                        <li>Time zone:   AZT (UTC+04)</li>
                        <li>Population:   9,754,830</li>
                    </ul>
                </div>
                <div class="col-sm-5 flames">
                    <img src="img/flames.svg" alt="" class="img-responsive">
                </div>
            </div>
        </div>
    </div>

1 个答案:

答案 0 :(得分:-1)

试试这个

首先提出这个:

.parallax { 
    background-image: *image URL*;

    height: 100%; 

    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

然后将你的div放在HTML上,但要确保在div之前和之后添加了这段代码

<div class="parallax"></div>

应该是这样的:

<div class="parallax"></div>

<div>
  Whatever
</div>

<div class="parallax"></div>