Javascript 转盘与模板冲突

Javascript 转盘与模板冲突,javascript,jquery,html,css,twitter-bootstrap,Javascript,Jquery,Html,Css,Twitter Bootstrap,我想用一个定制的旋转木马 我希望旋转木马替换默认的标题,但是当我将旋转木马代码放在那里时,什么也没有发生 当我第一次尝试时,它确实出现了,但左箭头和右箭头无法正常工作 这是传送带: <header id="myCarousel" class="carousel slide"> <!-- Indicators --> <ol class="carousel-indicators"> <li data-target="#myC

我想用一个定制的旋转木马

我希望旋转木马替换默认的标题,但是当我将旋转木马代码放在那里时,什么也没有发生

当我第一次尝试时,它确实出现了,但左箭头和右箭头无法正常工作

这是传送带:

<header id="myCarousel" class="carousel slide">
    <!-- Indicators -->
    <ol class="carousel-indicators">
        <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
        <li data-target="#myCarousel" data-slide-to="1"></li>
        <li data-target="#myCarousel" data-slide-to="2"></li>
    </ol>

    <!-- Wrapper for Slides -->
    <div class="carousel-inner">
        <div class="item active">
            <!-- Set the first background image using inline CSS below. -->
            <div class="fill" style="background-image:url('');"></div>
            <div class="carousel-caption">

            </div>
        </div>
        <div class="item">
            <!-- Set the second background image using inline CSS below. -->
            <div class="fill" style="background-image:url('');"></div>
            <div class="carousel-caption">
            </div>
        </div>
        <div class="item">
            <!-- Set the third background image using inline CSS below. -->
            <div class="fill" style="background-image:url('');"></div>
            <div class="carousel-caption">
            </div>
        </div>
    </div>

    <!-- Controls -->
    <a class="left carousel-control" href="#myCarousel" data-slide="prev">
        <span class="icon-prev"></span>
    </a>
    <a class="right carousel-control" href="#myCarousel" data-slide="next">
        <span class="icon-next"></span>
    </a>
</header>

看看这个

我用模板设置了小提琴,并用一个引导旋转木马全屏代替图像

您无法使其工作的原因是模板站点在菜单链接中使用了滚动条。
这是一个简单的修复,只需将
标记交换到
div

您可以使用
,但这将在每一侧都有一个灰色阴影边缘区域

 <!-- Left and right controls -->
 <div class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
 <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
 <span class="sr-only">Previous</span>
 </div>
 <div class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
 <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
 <span class="sr-only">Next</span>
 </div> 

以前的
下一个

旋转木马没有出现的原因是旋转木马必须位于收割台内部,而不是收割台本身。改变这个

<header id="myCarousel" class="carousel slide">
...
</header>
这样它就能过滤掉旋转木马按钮,就像这样

$('a[href*=#]:not([href=#]):not([href=#myCarousel])').click(function() { ... }

()

请仅在问题正文中发布相关代码。没有人想浏览你的全部代码。另外,通过这种方式,即使您删除了链接的目标,代码仍然可以供将来参考。对不起!!我对这一切都不熟悉。快速提问,但我注意到在一些网站上,如果使用非常小的分辨率,旋转木马会变成“迷你旋转木马”,并移到顶部以保留图像的宽度。在css中有什么可以改变的吗?当我删除“height:100vh”时,它实现了这一点,但图像的大小一直在变化。事实并非如此,所以我希望它保持一定的高度和宽度不变。
<header>
    <div id="myCarousel" class="carousel slide" data-ride="carousel">
    ...
    </div>
</header>
$('a[href*=#]:not([href=#])').click(function() { ... }
$('a[href*=#]:not([href=#]):not([href=#myCarousel])').click(function() { ... }