This commit is contained in:
ken 2026-08-28 14:02:37 +08:00
parent 9939c6feff
commit 5d014c999e
3 changed files with 98 additions and 58 deletions

View File

@ -1,66 +1,66 @@
;(function($, win, undefined) {
// ECMAScript 5 嚴格模式
'use strict';
$(function() {
var $signLanguageBox = $('.orbit-bar-search-sign-language');
var $headerNav = $('.header-nav');
var $target = $('.header-nav [accesskey="U"], .header-nav [accesskey="W"]');
// $(function() {
// var $signLanguageBox = $('.orbit-bar-search-sign-language');
// var $headerNav = $('.header-nav');
// var $target = $('.header-nav [accesskey="U"], .header-nav [accesskey="W"]');
// 移除 color: inherit !important
$target.each(function() {
$(this)[0].style.removeProperty('color');
});
// // 移除 color: inherit !important
// $target.each(function() {
// $(this)[0].style.removeProperty('color');
// });
function handleNavMove() {
var windowWidth = window.innerWidth;
// function handleNavMove() {
// var windowWidth = window.innerWidth;
if (windowWidth > 768) {
if ($signLanguageBox.length && $signLanguageBox.find('[accesskey="U"], [accesskey="W"]').length === 0) {
$signLanguageBox.prepend($target);
}
} else {
if ($headerNav.length && $headerNav.find('[accesskey="U"], [accesskey="W"]').length === 0) {
$headerNav.append($target);
}
}
}
// if (windowWidth > 768) {
// if ($signLanguageBox.length && $signLanguageBox.find('[accesskey="U"], [accesskey="W"]').length === 0) {
// $signLanguageBox.prepend($target);
// }
// } else {
// if ($headerNav.length && $headerNav.find('[accesskey="U"], [accesskey="W"]').length === 0) {
// $headerNav.append($target);
// }
// }
// }
handleNavMove();
// handleNavMove();
$(window).on('resize', function() {
handleNavMove();
});
});
//blockquote移動
$(function() {
// 1. 定義變數,減少重複選取 DOM 的效能消耗
var $signLanguageBox = $('.orbit-bar-search-sign-language');
var $headerNav = $('.header-nav');
var $target = $('.header-nav blockquote');
// $(window).on('resize', function() {
// handleNavMove();
// });
// });
// //blockquote移動
// $(function() {
// // 1. 定義變數,減少重複選取 DOM 的效能消耗
// var $signLanguageBox = $('.orbit-bar-search-sign-language');
// var $headerNav = $('.header-nav');
// var $target = $('.header-nav blockquote');
function handleNavMove() {
var windowWidth = window.innerWidth;
// function handleNavMove() {
// var windowWidth = window.innerWidth;
if (windowWidth > 768) {
if ($signLanguageBox.length && $signLanguageBox.find('blockquote').length === 0) {
$signLanguageBox.prepend($target);
}
} else {
if ($headerNav.length && $headerNav.find('blockquote').length === 0) {
$headerNav.append($target); // 或者用 .prepend() 取決於你要放的位置
}
}
}
// if (windowWidth > 768) {
// if ($signLanguageBox.length && $signLanguageBox.find('blockquote').length === 0) {
// $signLanguageBox.prepend($target);
// }
// } else {
// if ($headerNav.length && $headerNav.find('blockquote').length === 0) {
// $headerNav.append($target); // 或者用 .prepend() 取決於你要放的位置
// }
// }
// }
// 初始執行一次
handleNavMove();
// // 初始執行一次
// handleNavMove();
// 監聽視窗縮放
$(window).on('resize', function() {
// 加上防抖 (Debounce) 可以讓效能更好,但若要即時反應可直接執行
handleNavMove();
});
});
// // 監聽視窗縮放
// $(window).on('resize', function() {
// // 加上防抖 (Debounce) 可以讓效能更好,但若要即時反應可直接執行
// handleNavMove();
// });
// });
//header fixed在上方
$(function(){
function initdata1(){
@ -2292,6 +2292,7 @@ $(function() {
// if($('.show-announcement').hasClass('show-announcement')) {
// $('.').css('', '');
// }
$('.header-nav').append($('[accesskey="W"]'));
$(function() {
var $headerNav = $('.header-nav');
$headerNav.contents().each(function() {
@ -3098,10 +3099,10 @@ $(document).ready(function() {
fixVideoPosterAlt();
});
//網站導覽換icon
// $(document).ready(function() {
// $('a[href="/zh_tw/sitemap"]').html('<i class="fa-solid fa-sitemap"></i>');
// $('a[href="/en/sitemap"]').html('<i class="fa-solid fa-sitemap"></i>')
// });
$(document).ready(function() {
$('a[href="/zh_tw/sitemap"]').html('<i class="fa-solid fa-sitemap"></i>');
$('a[href="/en/sitemap"]').html('<i class="fa-solid fa-sitemap"></i>')
});
//#tdstylesp表格樣式
$(function () {
$('#tdstylesp').each(function () {
@ -3784,6 +3785,33 @@ $(document).ready(function() {
}
});
//中英切換紐 class用lang-switch
$(function() {
$('.lang-switch').on('click', function(e) {
e.preventDefault();
var lang = document.documentElement.lang;
var path = window.location.pathname;
var newUrl;
if (lang === 'en') {
// 英文 → 中文
if (path === '/' || path === '') {
newUrl = '/?locale=zh_tw';
} else {
newUrl = path.replace(/^\/en/, '/zh_tw');
}
} else {
// 中文 → 英文
if (path === '/' || path === '') {
newUrl = '/?locale=en';
} else {
newUrl = path.replace(/^\/zh_tw/, '/en');
}
}
window.location.href = newUrl;
});
});
}(jQuery, window));

View File

@ -67,9 +67,6 @@
.navbar-header{
// float: none!important;
}
}
.layout-content-box{
}
.topcontent{
z-index: 3;
@ -102,6 +99,7 @@
}
.layout-content {
position: relative;
min-height: 70.5em;
.container {
@extend .response-container;
}

View File

@ -79,3 +79,17 @@
});
});
</script>
<style type="text/css">
.w-ba-banner .controlplay .resume-slide.active i{
color: #32D9C3;
}
.w-ba-banner .controlplay .pause-slide.active i{
color: #ff4500;
}
.w-ba-banner .controlplay{
width: auto;
}
.next-button,.prev-button{
cursor: pointer;
}
</style>