【发布时间】:2016-05-12 20:16:05
【问题描述】:
我正在尝试打开导航栏菜单,无论是悬停还是聚焦。这是我尝试过的: 但是在悬停时它工作正常,但在焦点上应该打开菜单列表。
由于屏幕阅读器使用键盘标签按钮,我需要打开菜单列表,就像悬停时打开一样。
JS:
$(document).ready(function(){
$(".dropdown").hover(
function() {
$('.dropdown-menu', this).stop( true, true ).slideDown("fast");
$(this).toggleClass('open');
},
function() {
$('.dropdown-menu', this).stop( true, true ).slideUp("fast");
$(this).toggleClass('open');
}
).focus(function() {
$('.dropdown-menu', this).stop( true, true ).slideDown("fast");
$(this).toggleClass('open');
},
function() {
$('.dropdown-menu', this).stop( true, true ).slideUp("fast");
$(this).toggleClass('open');
}
)
});
小提琴链接: Demo
【问题讨论】:
-
“焦点”是什么意思?关注什么?
-
每当我按下键盘标签按钮时的屏幕阅读器。
标签: javascript jquery twitter-bootstrap