gpt4 book ai didi

Javascript 原型(prototype)-轮播

转载 作者:太空宇宙 更新时间:2023-11-04 15:53:51 24 4
gpt4 key购买 nike

我在 ( http://code.google.com/p/prototype-carousel/ ) 找到了这段代码,但不知何故我无法让他工作。有人能帮助我吗?图像加载正常,但简单的按钮什么都不做。提前致谢。

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Teste</title>
<script type="text/javascript" src="prototype.js"></script>
<script type="text/javascript" src="scriptaculous.js"></script>
<script type="text/javascript" src="carousel.js"></script>
<style type="text/css">

#carousel-wrapper {
width: 980px;
height: 580px;
overflow: hidden;
}
#carousel-content {
width: 2500px;
}
#carousel-content .slide {
float: left;
width: 980px;
height: 580px;
}


</style>
</head>

<body>
<div id="carousel-wrapper">

<div class="controls">
<a href="javascript:" class="carousel-control" rel="next" style="float: right">Next</a>
<a href="javascript:" class="carousel-control" rel="prev">Previous</a>
</div>

<div id="carousel-content">
<div class="slide">
<img src="sample1.jpg" />
</div>

<div class="slide">
<img src="sample2.jpg" />
</div>

<div class="slide">
<img src="sample3.jpg" />
</div>

</div>

<script type="text/javascript">
new Carousel('carousel-wrapper', $$('#carousel-content .slide'), $$('a.carousel-control'),
{ wheel:false, circular:true, auto:false, effect:scroll, frequency:5, duration:1, });
</script>

</div>

</body>

</html>

最佳答案

你需要包含 CSS

#carousel-wrapper {
width: 500px;
height: 500px;
overflow: hidden;
}
#carousel-content {
width: 2500px;
}
#carousel-content .slide {
float: left;
width: 500px;
height: 500px;
}​

您可能还应该移动控件和 <script>包装外的内容。

这是一个工作示例:

http://jsfiddle.net/eyweA/1/

关于Javascript 原型(prototype)-轮播,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10840295/

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