简体   繁体   English

在jQuery Orbit Plugin 1.2.3中使用div元素

[英]using div elements with jQuery Orbit Plugin 1.2.3

I am trying to use an older version of Orbit, 1.2.3, and I am trying to make a carousel for a few div's. 我正在尝试使用旧版本的Orbit 1.2.3,并且正在尝试为几个div制作轮播。 It would rotate like how it would rotate img tags. 它会像旋转img标签一样旋转。 I got it to work for the images but when it comes to the divs, it just overlaps all the div elements on top of eachother 我把它用于图像,但是当涉及到div时,它只是将所有div元素彼此重叠

The javascript is: JavaScript是:

function onRecommendationPageletLayout() {
$(document).ready(function() {
    jQuery('#awsmp-hero-featureSwap').show().orbit({
        animation : 'vertical-slide',
        animationSpeed : 0,
        advanceSpeed : 5500,
        pauseOnHover : true,
        directionalNav : true,
        captions : false,
        bullets : true,
        timer : false
    });
});
}

The code for the images is as follows and works correctly: 图像的代码如下,并且可以正常工作:

<div id="awsmp-hero-featureSwap">
<img
    src="https://images-na.ssl-images-amazon.com/images/G/01/AWSMP/en_US/images/aiscaler-dynamic-site-img-logo.jpg"
    alt="Overflow: Hidden No More" /> <img
    src="https://images-na.ssl-images-amazon.com/images/G/01/AWSMP/en_US/images/a-ten-networks-vthunder-img.jpg"
    alt="HTML Captions" /> <img
    src="https://images-na.ssl-images-amazon.com/images/G/01/AWSMP/en_US/images/vyatta-virtual-router-img-logo.jpg"
    alt="and more features" />
</div>

But when it comes to the div elements it does not apply the carousel and overlaps all the div elements : 但是,当涉及div元素时,它不会应用轮播,并且会覆盖所有div元素:

<div id="awsmp-hero-featureSwap">
    <div>some content here</div>
    <div>more content here</div>
    <div>this is the 3rd slide</div>
</div>

it shows it like in the following image: 如下图所示: 在此处输入图片说明

The CSS for the div elements is div元素的CSS是

style="z-index: 1; 
display: block; 
top: 0px;"

as you can see, it overlaps all the div elements. 如您所见,它与所有div元素重叠。 The javascript does its job and places the right div on top by changing the z-index. javascript会执行其工作,并通过更改z-index将正确的div放在顶部。 I have played around with the CSS but seems like I am missing one CSS element. 我玩过CSS,但似乎缺少一个CSS元素。 All help is greatly appreciated! 非常感谢所有帮助! Thanks 谢谢

we actually did this. 我们实际上是这样做的。 You have to add a background color to your div. 您必须为div添加背景色。 Otherwise your div background is transparent. 否则,您的div背景是透明的。 Try targeting your '.orbit div' in a CSS sheet or in the head and add a background color to the div elements. 尝试在CSS片或头瞄准你的“.orbit DIV”,并添加一个背景颜色的div元素。

So you CSS would look like 所以你的CSS看起来像

.orbit div{background:white}

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

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