Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/453.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 实现twitter引导carousel v2.3.2_Javascript_Html_Twitter Bootstrap_Carousel_Twitter Bootstrap 2 - Fatal编程技术网

Javascript 实现twitter引导carousel v2.3.2

Javascript 实现twitter引导carousel v2.3.2,javascript,html,twitter-bootstrap,carousel,twitter-bootstrap-2,Javascript,Html,Twitter Bootstrap,Carousel,Twitter Bootstrap 2,我在实现引导转盘时遇到问题。任何人都可以看看下面的html和js,并告诉我如何实现幻灯片。js尚未编辑,旋转木马安装在body hero单元上。我是否实现了carouselapi?如何定义在.js文件中使用的旋转木马?谢谢 <div class="carousel"> <!-- Carousel items --> <div class="carousel-inner"> <!-- Main hero unit for a pri

我在实现引导转盘时遇到问题。任何人都可以看看下面的html和js,并告诉我如何实现幻灯片。js尚未编辑,旋转木马安装在body hero单元上。我是否实现了carouselapi?如何定义在.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 &raquo;</a></p>
      </div>  

  </div>      

 <!-- Carousel nav -->

  <a class="carousel-control left" href="#myCarousel" data-slide="prev">&lsaquo;</a>
  <a class="carousel-control right" href="#myCarousel" data-slide="next">&rsaquo;</a>

  </div>

你好,世界!
这是一个简单的营销或信息网站的模板。它包括一个称为“英雄单元”的大型标注和三个支持内容。把它作为一个起点来创造更独特的东西


引导转盘的文档可在以下位置获得:

我想您需要添加类似这样的内容才能使其运行:

<script type="text/javascript">
$(function(){
   $('.carousel').carousel();
});
</script>

$(函数(){
$('.carousel').carousel();
});

我的理解是

<div class="carousel">

需要

<div id="myCarousel" class="carousel">


其中id是“Arrows”href所指的内容。

注意:此答案最初用于(可能不适用于版本3)

您必须在所有幻灯片上显示“项目”类,在第一张幻灯片上显示“活动”类。这对我有用

<div class="carousel">
  <div class="carousel-inner">


<!-- your slide -->

     <div class="hero-unit item active">
                <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 &raquo;</a></p>
     </div> 

  </div>
</div>

你好,世界!
这是一个简单的营销或信息网站的模板。它包括一个称为“英雄单元”的大型标注和三个支持内容。把它作为一个起点来创造更独特的东西

了解更多信息»

就像Christopher说的,你需要使用这个函数来启动它

<script type="text/javascript">
$(function(){
   $('.carousel').carousel();
});
</script>

$(函数(){
$('.carousel').carousel();
});

示例代码中没有项目。 要让它工作,你需要至少有两个项目,在你的旋转木马内部分区

  • 创建第二项
  • 确保第一个项目具有活动类;这就开始了
  • 裸代码应该是这样的
  • 
    …
    …
    …
    
    这是Joomla 3.1.1中基于引导的Protostar模板。 我没有让旋转木马自动循环。这对我很有用:

    使用自定义html模块,添加以下代码: (将
    img
    scr
    、alt文本和字幕文本更改为自定义)


    我认为bootstrap是通过一个$().carousel()连接到类中的;键入呼叫。我在第一张幻灯片上没有活动,这是一个完整的wtf时刻
    <div class="carousel-inner">
       <div class="active item">…</div>
       <div class="item">…</div>
       <div class="item">…</div>
    </div>
    
    <div id="myCarousel" class="carousel slide">
        <ol class="carousel-indicators" style="list-style: none;">
            <li class="active" data-target="#myCarousel" data-slide-to="0"></li>
            <li data-target="#myCarousel" data-slide-to="1"></li>
            <li data-target="#myCarousel" data-slide-to="2"></li>
        </ol>
    
        <!-- Carousel items -->
        <div class="carousel-inner">
            <div class="active item">
                <img src="images/headers/maple.jpg" alt="imagetext 1" />
                <div class="carousel-caption">
                    <h4>Exampletext 1</h4>
                </div>
            </div>
            <div class="item">
                <img src="images/headers/raindrops.jpg" alt="imagetext 2" />
                <div class="carousel-caption">
                    <h4>Exampletext</h4>
                </div>
            </div>
            <div class="item">
                <img src="images/headers/windows.jpg" alt="imagetext 3" />
                <div class="carousel-caption">
                    <h4>Exampletext</h4>
                </div>
            </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>
    
    <!-- Call Carousel --> 
    <script type="text/javascript">
    (function($){$('.carousel').carousel({ interval: 5000, pause:'hover'});
    })(jQuery);
    </script>
    
    // CSUTOM disable mootools-more.js
    unset (JFactory::getDocument()->_scripts['/jomaatcms/media/system/js/mootools-core.js']);
    unset (JFactory::getDocument()->_scripts['/jomaatcms/media/system/js/mootools-more.js']);