update
This commit is contained in:
parent
fffbd8b6c9
commit
b2954a1034
|
|
@ -3241,6 +3241,116 @@ $(document).ready(function () {
|
|||
fixSearchInputA11y();
|
||||
}, 500);
|
||||
});
|
||||
//會員tab邏輯
|
||||
$(document).ready(function () {
|
||||
setTimeout(function () {
|
||||
$('.dtr-control').removeAttr('tabindex');
|
||||
}, 500);
|
||||
});
|
||||
function fixTabKeyboardNav() {
|
||||
setTimeout(function () {
|
||||
var $tablist = $('.member-plugins[role="tablist"]');
|
||||
var $tabs = $tablist.find('a[role="tab"]');
|
||||
|
||||
// 初始化 roving tabindex 和 aria-selected
|
||||
$tabs.each(function (i) {
|
||||
var $tab = $(this);
|
||||
var isActive = $tab.closest('li').hasClass('active');
|
||||
$tab.attr({
|
||||
'tabindex': isActive ? '0' : '-1',
|
||||
'aria-selected': isActive ? 'true' : 'false'
|
||||
});
|
||||
});
|
||||
|
||||
// 方向鍵切換頁籤
|
||||
$tabs.on('keydown', function (e) {
|
||||
var $current = $(this);
|
||||
var currentIndex = $tabs.index($current);
|
||||
var $target;
|
||||
|
||||
if (e.keyCode === 39 || e.keyCode === 40) {
|
||||
// 右鍵或下鍵:下一個
|
||||
e.preventDefault();
|
||||
$target = $tabs.eq((currentIndex + 1) % $tabs.length);
|
||||
} else if (e.keyCode === 37 || e.keyCode === 38) {
|
||||
// 左鍵或上鍵:上一個
|
||||
e.preventDefault();
|
||||
$target = $tabs.eq((currentIndex - 1 + $tabs.length) % $tabs.length);
|
||||
} else if (e.keyCode === 36) {
|
||||
// Home:第一個
|
||||
e.preventDefault();
|
||||
$target = $tabs.first();
|
||||
} else if (e.keyCode === 35) {
|
||||
// End:最後一個
|
||||
e.preventDefault();
|
||||
$target = $tabs.last();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
// 更新 roving tabindex 和 aria-selected
|
||||
$tabs.attr({ 'tabindex': '-1', 'aria-selected': 'false' });
|
||||
$target.attr({ 'tabindex': '0', 'aria-selected': 'true' });
|
||||
$target.focus().trigger('click');
|
||||
});
|
||||
|
||||
// 點擊頁籤時同步更新狀態
|
||||
$tabs.on('click', function () {
|
||||
$tabs.attr({ 'tabindex': '-1', 'aria-selected': 'false' });
|
||||
$(this).attr({ 'tabindex': '0', 'aria-selected': 'true' });
|
||||
});
|
||||
|
||||
}, 500);
|
||||
}
|
||||
$(document).ready(function () {
|
||||
fixTabKeyboardNav();
|
||||
});
|
||||
function removeBareUrlLinks() {
|
||||
setTimeout(function() {
|
||||
$('.dataTables_wrapper a').each(function() {
|
||||
var $a = $(this);
|
||||
var text = $a.text().trim();
|
||||
|
||||
if (/^https?:\/\//i.test(text)) {
|
||||
$a.replaceWith(text);
|
||||
}
|
||||
});
|
||||
}, 500);
|
||||
}
|
||||
$(document).ready(function() {
|
||||
removeBareUrlLinks();
|
||||
});
|
||||
//麵包屑無障礙
|
||||
$(document).ready(function () {
|
||||
$('.widget-breadcrumb .breadcrumb li:last-child a').attr('aria-current', 'page');
|
||||
|
||||
// 若尚未有 nav 包住,自動加上
|
||||
$('.widget-breadcrumb .breadcrumb').each(function () {
|
||||
if (!$(this).closest('nav').length) {
|
||||
$(this).wrap('<nav aria-label="麵包屑導覽"></nav>');
|
||||
}
|
||||
});
|
||||
});
|
||||
//gallery view
|
||||
function fixGalleryViewLinkA11y() {
|
||||
$('a.btn.view').each(function () {
|
||||
var $a = $(this);
|
||||
|
||||
$a.find('span').each(function () {
|
||||
var $span = $(this);
|
||||
|
||||
// 避免重複處理
|
||||
if ($span.hasClass('sr-only')) return;
|
||||
|
||||
var style = $span.attr('style') || '';
|
||||
if (style.indexOf('display: none') !== -1 || style.indexOf('display:none') !== -1) {
|
||||
$span.removeAttr('style').addClass('sr-only');
|
||||
}
|
||||
});
|
||||
|
||||
$a.find('i, svg').attr('aria-hidden', 'true');
|
||||
});
|
||||
}
|
||||
// 執行 member等高計算,目前改用flexbox故mark掉 by ika 20160105
|
||||
// $(window).load(function() {
|
||||
// if ($('.index-member-3').length && $(window).width() > 992) {
|
||||
|
|
|
|||
|
|
@ -38,9 +38,7 @@
|
|||
// }
|
||||
.orbit-bar-inner{
|
||||
[accesskey="U"]{
|
||||
height: 40px;
|
||||
display: inline-block!important;
|
||||
line-height: 40px;
|
||||
float: left;
|
||||
@media(min-width:769px){
|
||||
color: #fff!important;
|
||||
|
|
|
|||
Loading…
Reference in New Issue