fix(nav): restore reference theme toggle geometry and single binding
The top-bar theme switch was bound twice — core/theme.js attached a click handler to #theme-toggle-desktop while runtime/main.js delegated click on .toggle-theme, and both ship in main.min.js, so one press toggled twice and the button looked dead. Also realign the control with the reference: - Drop the far modifier from fa-toggle-theme so the sun/moon glyphs resolve against the Solid face at the reference weight instead of Regular. - Restore .toggle-radius .fa/.icon to the reference form (left/right 0 + auto margin only). The extra position/top/transform/size/flex block and the > i selector were overriding the shared abs-* centering rule. - Replace the per-ID bindings with one delegated listener so the floating rail, which carries no id, keeps working. - Remove dead theme.js queries for selectors no markup or stylesheet ships (#theme-toggle, #dropdown-theme-toggle, .theme-icon-moon/.theme-icon-sun, [data-action='toggle-theme'], .is-dark). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
e30de6562c
commit
030baa511e
9 files changed
+19
-139
No files matched your search
@@ -63,7 +63,7 @@ if (!function_exists('jio_nav_mobile_content')) :
|
||||
if (in_array('m_menu', (array) ($ctx['theme_positions'] ?? []), true)) {
|
||||
$top_btns .= '<a href="javascript:;" class="toggle-theme toggle-radius" id="theme-toggle-mobile" title="'
|
||||
. esc_attr__('切换亮暗色', 'jio') . '">';
|
||||
$top_btns .= '<i class="fa far fa-toggle-theme" aria-hidden="true"></i>';
|
||||
$top_btns .= '<i class="fa fa-toggle-theme" aria-hidden="true"></i>';
|
||||
$top_btns .= '</a>';
|
||||
}
|
||||
if ('center' !== ($ctx['mobile_layout'] ?? 'center')) {
|
||||
|
||||
@@ -324,7 +324,7 @@ if (!function_exists('jio_menu_button')) :
|
||||
if (in_array('pc_nav', (array) ($ctx['theme_positions'] ?? []), true)) {
|
||||
$utility_buttons .= '<a href="javascript:;" class="toggle-theme toggle-radius" id="theme-toggle-desktop" title="'
|
||||
. esc_attr__('切换亮暗色', 'jio') . '">';
|
||||
$utility_buttons .= '<i class="fa far fa-toggle-theme" aria-hidden="true"></i>';
|
||||
$utility_buttons .= '<i class="fa fa-toggle-theme" aria-hidden="true"></i>';
|
||||
$utility_buttons .= '</a>';
|
||||
}
|
||||
if (function_exists('jio_get_translate_language_btn')) {
|
||||
|
||||
@@ -168,7 +168,7 @@ if (!function_exists('jio_float_right')) :
|
||||
|
||||
switch ($type) {
|
||||
case 'theme_mode':
|
||||
$btn .= '<a' . $style . ' class="float-btn toggle-theme hover-show"' . jio_float_btn_tooltip_attr(__('切换主题', 'jio'), $is_mobile) . ' href="javascript:;"><i class="fa fas fa-toggle-theme"></i></a>';
|
||||
$btn .= '<a' . $style . ' class="float-btn toggle-theme hover-show"' . jio_float_btn_tooltip_attr(__('切换主题', 'jio'), $is_mobile) . ' href="javascript:;"><i class="fa fa-toggle-theme"></i></a>';
|
||||
break;
|
||||
|
||||
case 'back_top':
|
||||
|
||||
Reference in new issue
Block a user