Html 辅助功能-使用键盘上的tab键时,Bootstrap4旋转木马控件选项卡不会转到旋转木马标题div
PFB就是一个例子,这里我用它来进行引导转盘控制 这个例子工作得很好,但当我使用键盘上的tab键时,控件并没有继续使用类“carousel caption”在div内锚定标记 我尝试了锚定标记的“tab index”属性来设置选项卡,但选项卡无法正常工作 我希望选项卡的工作方式如下所示:Html 辅助功能-使用键盘上的tab键时,Bootstrap4旋转木马控件选项卡不会转到旋转木马标题div,html,css,twitter-bootstrap,bootstrap-4,bootstrap-carousel,Html,Css,Twitter Bootstrap,Bootstrap 4,Bootstrap Carousel,PFB就是一个例子,这里我用它来进行引导转盘控制 这个例子工作得很好,但当我使用键盘上的tab键时,控件并没有继续使用类“carousel caption”在div内锚定标记 我尝试了锚定标记的“tab index”属性来设置选项卡,但选项卡无法正常工作 我希望选项卡的工作方式如下所示: 左箭头->第一锚标签(“洛杉矶总是那么有趣!”)->第二锚标签(“谢谢你,芝加哥!”)->第三锚标签(“我们爱大苹果!”)->右箭头 有人能告诉我如何为你实现标签吗 <div id="myCarou
- 左箭头->第一锚标签(“洛杉矶总是那么有趣!”)->第二锚标签(“谢谢你,芝加哥!”)->第三锚标签(“我们爱大苹果!”)->右箭头
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- 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">
<img src="C:\Users\user1\Desktop\Sample\video-bg-static1.png" alt="Los Angeles" style="width:100%;">
<div class="carousel-caption">
<h3>Los Angeles</h3>
<a>LA is always so much fun!</a>
</div>
</div>
<div class="item">
<img src="C:\Users\user1\Desktop\Sample\video-bg-static2.png" alt="Chicago" style="width:100%;">
<div class="carousel-caption">
<h3>Chicago</h3>
<a>Thank you, Chicago!</a>
</div>
</div>
<div class="item">
<img src="C:\Users\user1\Desktop\Sample\video-bg-static3.png" alt="New york" style="width:100%;">
<div class="carousel-caption">
<h3>New York</h3>
<a>We love the Big Apple!</a>
</div>
</div>
</div>
<!-- Left and right controls -->
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
<span class="sr-only">Next</span>
</a>
</div>
洛杉矶
根据您的评论:
…在这里,我想使用键盘在旋转木马控件之间导航
你可以用。如文件所述:
键盘事件仅由和具有contentEditable属性或tabindex=“-1”的任何内容生成
需要将tabindex=“-1”添加到旋转木马div和事件处理程序中
$('myCarousel')。打开('keydown',函数(e){
如果(e.keyCode==37){//左箭头
$('myCarousel')。carousel('prev'))
}否则{
如果(e.keyCode==39){//右箭头
$('myCarousel')。carousel('next'))
}
}
})
洛杉矶
您不能在上定义标签索引,因此我们必须将ul.carousel indicators>li
包装在锚定标签内(该标签可与标签索引一起使用)
检查代码,该代码使用相同的示例,并根据需要实现tabIndex
更新:根据提问者的评论,选项卡索引现在转到每张幻灯片标题下的
,而不是转盘指示器;这些
芝加哥
纽约
我想你误解了我的问题。在这里,我想使用键盘在旋转木马控件之间导航。如果您对此有任何想法,请告诉我。谢谢您的快速回复。根据您的回答,控件将继续指向旋转木马指示器(旋转木马控件下方的点),但我希望控件继续指向旋转木马标题中的锚定标记(在本例中,锚定标记为“LA总是那么有趣!”)。“你能给我提个建议吗?”阿维纳什,现在请查收