实现 twitter bootstrap carousel v2.3.2
我在实现引导轮播时遇到问题。谁能看一下下面的 html 和 js 并给我关于如何实现幻灯片的说明。 .js 尚未编辑,轮播已安装在主体英雄单元上。我是否实现了轮播 API?如何定义在 .js 文件中使用的轮播?谢谢。
<div class="carousel">
<!-- Carousel items -->
<div class="carousel-inner">
<!-- Main hero unit for a primary marketing message or call to action -->
<div class="hero-unit">
<h1>Hello, world!</h1>
<p>This is a template for a simple marketing or informational website. It includes a large callout called the hero unit and three supporting pieces of content. Use it as a starting point to create something more unique.</p>
<p><a class="btn btn-primary btn-large">Learn more »</a></p>
</div>
</div>
<!-- Carousel nav -->
<a class="carousel-control left" href="#myCarousel" data-slide="prev">‹</a>
<a class="carousel-control right" href="#myCarousel" data-slide="next">›</a>
</div>
I am having trouble implementing the bootstrap carousel. Can anyone look at the following html and js and give me instructions on how to implement the slide. The .js has not been edited and the carousel is installed on the body hero unit. Do I implement the carousel api? How do I define the carousel I am using within the .js file? Thanks.
<div class="carousel">
<!-- Carousel items -->
<div class="carousel-inner">
<!-- Main hero unit for a primary marketing message or call to action -->
<div class="hero-unit">
<h1>Hello, world!</h1>
<p>This is a template for a simple marketing or informational website. It includes a large callout called the hero unit and three supporting pieces of content. Use it as a starting point to create something more unique.</p>
<p><a class="btn btn-primary btn-large">Learn more »</a></p>
</div>
</div>
<!-- Carousel nav -->
<a class="carousel-control left" href="#myCarousel" data-slide="prev">‹</a>
<a class="carousel-control right" href="#myCarousel" data-slide="next">›</a>
</div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我的理解是,
都需要位于id 的位置。
无论“箭头”的 href 是什么,
My understanding is that
Needs to be
where the id is whatever the "Arrows"' href is.
Bootstrap Carousel 的文档可在此处找到: http://twitter.github.com/bootstrap/ javascript.html#carousel
我想您需要添加类似的内容才能使其运行:
The documentation for Bootstrap Carousel is available here: http://twitter.github.com/bootstrap/javascript.html#carousel
I guess you would need to add something like this to get it running:
您的示例代码中没有任何项目。
为了让它工作,你需要至少有两个项目,在你的 carousel-inner div 中。
。
You have no items in your example code.
to get it to work you need to have at least two items, with in your carousel-inner div.
.
这是 Joomla 3.1.1 中的 Protostar 模板,该模板基于 Bootstrap。
我没有让旋转木马自动循环。这对我有用:
使用自定义 html 模块,添加以下代码:
(更改
img
scr
、alt 文本和标题文本以进行自定义)模板的 index.php 中的此调整是为了防止脚本之间的冲突,它会禁用 mootools,从而导致在幻灯片之间打开和关闭的轮播:
This is in Joomla 3.1.1 with the Protostar template which is based on Bootstrap.
I did't get the carousel to automticly cycle. This worked for me:
Use a Custom html module, add this code:
(change the
img
scr
, alt text and caption text to customize)This adjustments in the index.php of your template is to prevent confict between scripts, it disables mootools which causes the carousel to open and close beween slides:
注意:此答案最初适用于Bootstrap 2.3.2< /strong>(可能不适用于版本 3)
您必须将类“item”放在所有幻灯片上,并将类“active”放在第一张幻灯片上。这对我有用。
正如克里斯托弗所说,您需要使用此功能来启动它。
Note: this answer was originally for Bootstrap 2.3.2 (may not work with version 3)
You have to put the class "item" on all of your slides and the class "active" on the first slide. This worked for me.
And like Christopher said you need to use this function to initiate it.