Fix chevron icon rotation to use single 180-degree toggle
This commit is contained in:
@ -743,19 +743,29 @@ function wp_allstars_settings_page() {
|
|||||||
<script>
|
<script>
|
||||||
jQuery(document).ready(function($) {
|
jQuery(document).ready(function($) {
|
||||||
// Handle accordion functionality
|
// Handle accordion functionality
|
||||||
$('.wp-allstars-expand-settings').on('click', function(e) {
|
$('.wp-allstars-expand-settings').each(function() {
|
||||||
e.preventDefault();
|
|
||||||
|
|
||||||
var $button = $(this);
|
var $button = $(this);
|
||||||
var $panel = $button.closest('.wp-allstars-toggle').find('.wp-allstars-toggle-settings');
|
var $panel = $button.closest('.wp-allstars-toggle').find('.wp-allstars-toggle-settings');
|
||||||
var $icon = $button.find('.dashicons');
|
var $icon = $button.find('.dashicons');
|
||||||
|
|
||||||
// Toggle panel
|
// Set initial state
|
||||||
$panel.slideToggle(200, function() {
|
var isExpanded = $panel.is(':visible');
|
||||||
// Update state after animation completes
|
$button.attr('aria-expanded', isExpanded);
|
||||||
var isExpanded = $panel.is(':visible');
|
$icon.css('transform', isExpanded ? 'rotate(180deg)' : '');
|
||||||
|
|
||||||
|
// Handle click events
|
||||||
|
$button.on('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
// Toggle panel
|
||||||
|
$panel.slideToggle(200);
|
||||||
|
|
||||||
|
// Toggle state
|
||||||
|
isExpanded = !isExpanded;
|
||||||
$button.attr('aria-expanded', isExpanded);
|
$button.attr('aria-expanded', isExpanded);
|
||||||
$icon.css('transform', isExpanded ? 'rotate(180deg)' : 'rotate(0deg)');
|
|
||||||
|
// Update icon rotation
|
||||||
|
$icon.css('transform', isExpanded ? 'rotate(180deg)' : '');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user