【发布时间】:2018-02-25 16:34:14
【问题描述】:
默认引导轮播控件(左右箭头)具有跨越轮播中图像高度 100% 的链接。我很抱歉,因为这可能是一个愚蠢的问题,但是您如何更改此设置以使链接仅超出箭头本身的宽度和高度?
您可以在 Boostrap 文档 (https://getbootstrap.com/docs/3.3/javascript/#carousel) 的“轮播”下查看我的意思示例,轮播代码如下。
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src="..." alt="...">
<div class="carousel-caption">
...
</div>
</div>
<div class="item">
<img src="..." alt="...">
<div class="carousel-caption">
...
</div>
</div>
...
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
【问题讨论】:
-
' 链接仅超出箭头本身的宽度和高度' 你是什么意思?
-
您可以编辑 carousel-control 类的 css 以更改其大小。向 .carousel-control 类添加高度属性。
-
O,如果您在谈论实际的 glyphicon 图标大小,您可以在实际图标中添加一个类以更改其大小,就像在这个问题中一样:stackoverflow.com/questions/18478365/bigger-glyphicons
-
查看 Jake Wilson 的回答 stackoverflow.com/questions/28678542/…
-
@Gagantous 不,例如,如果您查看我发布的链接中的轮播并将鼠标悬停在图像的右上角,您会看到该链接一直延伸到旋转木马的顶部...不仅仅是箭头本身。
标签: html css twitter-bootstrap