update
This commit is contained in:
parent
09669da563
commit
2457263757
|
|
@ -3187,6 +3187,96 @@ $(document).ready(function () {
|
||||||
fixSortLinkA11y();
|
fixSortLinkA11y();
|
||||||
fixSearchInputA11y();
|
fixSearchInputA11y();
|
||||||
}, 500);
|
}, 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>');
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
// 執行 member等高計算,目前改用flexbox故mark掉 by ika 20160105
|
// 執行 member等高計算,目前改用flexbox故mark掉 by ika 20160105
|
||||||
// $(window).load(function() {
|
// $(window).load(function() {
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
}
|
}
|
||||||
.footer-counter a { padding-right: 0.5em; }
|
.footer-counter a { padding-right: 0.5em; }
|
||||||
a {
|
a {
|
||||||
color: #337ab7;
|
color: #65a2d7;
|
||||||
&:hover,
|
&:hover,
|
||||||
&:focus {
|
&:focus {
|
||||||
opacity: .8;
|
opacity: .8;
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="w-ad-banner__caption ad-overlay w-ba-banner__caption w-ad-banner__caption w-ad-banner__overlay_{{subpart-id}}"></div>
|
|
||||||
<div class="w-ad-banner__pager-1 w-ba-banner__caption banner-pager banner_caption_{{subpart-id}}" data-list="images" data-level="0">
|
<div class="w-ad-banner__pager-1 w-ba-banner__caption banner-pager banner_caption_{{subpart-id}}" data-list="images" data-level="0">
|
||||||
<li><button title="Slide {{slide_number}}"><span style="display: none;">Slide {{slide_number}}</span></button></li>
|
<li><button title="Slide {{slide_number}}"><span style="display: none;">Slide {{slide_number}}</span></button></li>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue