gpt4 book ai didi

javascript - 使用位于动画背景上方的 Bootstrap 3 获取网页内容

转载 作者:行者123 更新时间:2023-11-28 03:19:32 25 4
gpt4 key购买 nike

概述:我使用 Bootstrap 3 作为我的 CSS 框架,因此内容是使用其容器/网格系统组织的。背景动画由基本上相互锯齿形的蓝/绿对 Angular 线条组成。动画背景序列使用两个垂直重复的图像。目前,动画背景图像位于它们自己的容器/div 中。本质上,我正在尝试使背景容器上方的内容适合多个容器。

我的目标是让动画背景响应设备大小,但也能够将内容锚定到页面背景/动画的特定位置。最后我想根据鼠标的 y 轴位置触发其他事件。

最初我认为我可以将背景放在自己的容器中,然后将包含内容的容器/div 设置为更高的 z-index,这样它就会位于背景动画之上。从查看 jsfiddle 可以看出,我无法将内容容器定位在背景动画上方。它被推到页面底部。

我想知道是否需要在其自己的非 Bootstrap div 中制作背景,而只有内容使用 Bootstrap ?我可以使用 width: 100% 和 height: 100% 但我不确定我是否能够将某些内容锚定/修复到页面中的特定点。

我愿意接受任何和所有的建议。简而言之,我想让内容在动画背景上正确定位,同时还允许页面响应设备大小。

<body>        
<div class="container">
<div class="bluestrip">
<img src="http://i59.tinypic.com/rt0txj.jpg" />
</div>
<div class="greenstrip">
<img src="http://i57.tinypic.com/auv6fb.jpg" />
</div>
<div class="bluestrip extra">
<img src="http://i59.tinypic.com/rt0txj.jpg" />
</div>
<div class="greenstrip">
<img src="http://i57.tinypic.com/auv6fb.jpg" />
</div>
<div class="bluestrip extra">
<img src="http://i59.tinypic.com/rt0txj.jpg" />
</div>
<div class="greenstrip">
<img src="http://i57.tinypic.com/auv6fb.jpg" />
</div>
</div>
<div class='container zindex'>
<div class="row">
<div class='col-md-2'>
<img src="http://s26.postimg.org/8jazgghop/largest_iphone_3_of_3_14.gif">
</div>
<div class='col-md-2'>
<img src="http://s26.postimg.org/c46uzom89/medium_iphone_2_of_3_14.gif">
</div>
<div class='col-md-2'>
<img src="http://s26.postimg.org/c46uzom89/medium_iphone_2_of_3_14.gif">
</div>
</div>
</div>
</body>

http://jsfiddle.net/bismarck611/jt2k4o6z/

最佳答案

我能够通过一些代码更改来解决问题。从来没有想过是否有可能将两个具有不同 z-index 的容器相互堆叠。

<body>        
<div class="background-content">
<div class="bluestrip">
<img src="http://i59.tinypic.com/rt0txj.jpg" />
</div>
<div class="greenstrip">
<img src="http://i57.tinypic.com/auv6fb.jpg" />
</div>
<div class="bluestrip extra">
<img src="http://i59.tinypic.com/rt0txj.jpg" />
</div>
<div class="greenstrip">
<img src="http://i57.tinypic.com/auv6fb.jpg" />
</div>
<div class="bluestrip extra">
<img src="http://i59.tinypic.com/rt0txj.jpg" />
</div>
<div class="greenstrip">
<img src="http://i57.tinypic.com/auv6fb.jpg" />
</div>
</div>
<div class='container zindex'>
<div class="row">
<div class='col-md-2'>
<img src="http://s26.postimg.org/8jazgghop/largest_iphone_3_of_3_14.gif">
</div>
<div class='col-md-2'>
<img src="http://s26.postimg.org/c46uzom89/medium_iphone_2_of_3_14.gif">
</div>
<div class='col-md-2'>
<img src="http://s26.postimg.org/c46uzom89/medium_iphone_2_of_3_14.gif">
</div>
</div>
</div>
</body>

保存 img 的 div 我将 css 类更改为以下内容:

.background-content {
position: absolute;
z-index: -1;
min-width: 100%;
min-height: 100%;
}

这允许图像根据屏幕尺寸自行调整大小并适合页面内容下方。现在我仍然可以在我的 css 动画背景上使用 Bootstrap 框架。

关于javascript - 使用位于动画背景上方的 Bootstrap 3 获取网页内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25274640/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com