简体   繁体   English

带有单独背景幻灯片的滑块

[英]Slider with separate background slides

I'm trying to create an effect for a website which features a large content slider near the top of the page. 我正在尝试为在页面顶部附近具有较大内容滑块的网站创建效果。 Namely, I want to position a larger image behind the <div> containing the slider so that it shows outwards from the left, right and bottom, but stays behind other content. 即,我想在包含滑块的<div>后面放置一个较大的图像,以使其从左,右和底部向外显示,但在其他内容后面。 (Take a look at the slider on the frontpage of AutoDesk's website for a similar example) I'm currently using the Foundation 4 framework, and Unslider.js . (以类似的例子看一下AutoDesk网站首页上的滑块)我目前正在使用Foundation 4框架和Unslider.js。

Think of this structure: 考虑一下这种结构:

<ul class="slider-background">
    <li class="slider-bckgrnd"><img src="./bg.png"/></li>
    ...
    <li class="slider-bckgrnd"><img src="./bg.png"/></li>
<ul>

<div class="slider">
    <ul>
        <li class="slide"><img /></li>
        ...
        <li class="slide"><img /></li>
    </ul>
</div>

The biggest problem I'm having is figuring out how to get the background image to display behind everything else. 我遇到的最大问题是弄清楚如何让背景图片显示其他所有东西后面

I've tried the z-index, but that doesn't work for elements further down the page. 我已经尝试了z-index,但是对于页面下方的元素不起作用。 Is the solution an extra wrapper <div> around the whole thing? 解决方案是否是围绕整个事物的额外包装<div>

EDIT: I want a separate background for each individual slide, and the slides are of varying heights. 编辑:我想为每个单独的幻灯片一个单独的背景,并且幻灯片的高度各不相同。 I'm handling the positioning via jQuery / javascript. 我正在通过jQuery / javascript处理定位。

The solution was much easier than expected. 该解决方案比预期的要容易得多。 I simply had to assign position: relative; 我只需要分配position: relative; to the .row 's from Foundation to allow them to obey z-index rules. 来自Foundation的.row ,以允许他们遵守z-index规则。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM