update
This commit is contained in:
parent
170298efd8
commit
3832dea96b
|
|
@ -3848,5 +3848,76 @@ $(function() {
|
|||
|
||||
fixAccesskeySearch();
|
||||
});
|
||||
//搜尋
|
||||
$(function() {
|
||||
function fixFinFaqSearchStatusA11y() {
|
||||
setTimeout(function() {
|
||||
|
||||
var $searchInput = $('#finFaqSearch');
|
||||
if ($searchInput.length === 0) return;
|
||||
|
||||
// ✅ 加上 role="status" live region
|
||||
if ($('#fin-faq-search-status').length === 0) {
|
||||
$('body').append(
|
||||
'<div id="fin-faq-search-status" role="status" aria-live="polite" aria-atomic="true" class="sr-only"></div>'
|
||||
);
|
||||
}
|
||||
|
||||
$searchInput.off('input.faqStatus').on('input.faqStatus', function() {
|
||||
var keyword = $(this).val().trim();
|
||||
|
||||
setTimeout(function() {
|
||||
// ✅ 計算目前可見的 FAQ 項目數
|
||||
var $visible = $('.fin-faq-item').filter(function() {
|
||||
return $(this).css('display') !== 'none';
|
||||
});
|
||||
var count = $visible.length;
|
||||
|
||||
var message = keyword
|
||||
? '搜尋「' + keyword + '」的結果:共找到 ' + count + ' 筆問答。'
|
||||
: '顯示全部 ' + count + ' 筆問答。';
|
||||
|
||||
// ✅ 清空再設定確保每次都觸發
|
||||
$('#fin-faq-search-status').text('');
|
||||
setTimeout(function() {
|
||||
$('#fin-faq-search-status').text(message);
|
||||
}, 100);
|
||||
|
||||
}, 300);
|
||||
});
|
||||
|
||||
}, 500);
|
||||
}
|
||||
|
||||
fixFinFaqSearchStatusA11y();
|
||||
});
|
||||
$(function() {
|
||||
function fixFinFaqInputDescA11y() {
|
||||
setTimeout(function() {
|
||||
var $searchInput = $('#finFaqSearch');
|
||||
if ($searchInput.length === 0) return;
|
||||
|
||||
var hintId = 'finFaqSearchHint';
|
||||
|
||||
// ✅ 已有 hint 說明文字則只補 aria-describedby
|
||||
if ($('#' + hintId).length > 0) {
|
||||
$searchInput.attr('aria-describedby', hintId);
|
||||
return;
|
||||
}
|
||||
|
||||
// ✅ 沒有 hint 則插入說明文字
|
||||
var $hintEl = $('<small id="' + hintId + '" style="font-weight:400;color:#6f7c90;display:block;margin-bottom:4px;">輸入文字後,下方問答內容會即時自動篩選</small>');
|
||||
|
||||
// ✅ 插在 input 之前
|
||||
$searchInput.before($hintEl);
|
||||
|
||||
// ✅ 補上 aria-describedby
|
||||
$searchInput.attr('aria-describedby', hintId);
|
||||
|
||||
}, 500);
|
||||
}
|
||||
|
||||
fixFinFaqInputDescA11y();
|
||||
});
|
||||
|
||||
}(jQuery, window));
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ caption{
|
|||
position: relative;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
z-index: unset !important;
|
||||
z-index: 1;
|
||||
}
|
||||
.internal-page{
|
||||
.layout-content{
|
||||
|
|
|
|||
|
|
@ -29,9 +29,7 @@
|
|||
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-ad-banner__pager-2 w-ba-banner__caption banner-pager banner_caption_{{subpart-id}}" data-list="images" data-level="0">
|
||||
<li><button title="Slide {{slide_number}}" aria-label="Pager"><span style="display: none;">Slide {{slide_number}}</span></button></li>
|
||||
</div>
|
||||
<ul class="w-ba-banner__pager-2 banner-pager banner_caption_{{subpart-id}}"></ul>
|
||||
<ul class="controlplay" role="radiogroup" aria-label="播放控制選項">
|
||||
<a role="radio" aria-checked="true" href="javascript:;" class="resume-slide active" title="繼續播放" aria-label="繼續播放" aria-live="assertive">
|
||||
<i aria-hidden="true"></i>
|
||||
|
|
@ -49,7 +47,6 @@
|
|||
</ul>
|
||||
</div>
|
||||
<script>
|
||||
var flag = 1;
|
||||
$('[data-subpart-id="{{subpart-id}}"] .pause-slide').click(function(){
|
||||
$(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle('pause');
|
||||
$(this).addClass('active')
|
||||
|
|
@ -66,7 +63,7 @@
|
|||
})
|
||||
$('[data-subpart-id="{{subpart-id}}"] .prev-button').click(function(){
|
||||
$(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle("prev");
|
||||
})
|
||||
});
|
||||
/* 修正點:處理 Pager 無障礙朗讀文字 */
|
||||
$('.cycle-slideshow').on('cycle-post-initialize', function(event, optionHash) {
|
||||
var $container = $(this).closest('.w-ba-banner');
|
||||
|
|
|
|||
Loading…
Reference in New Issue