This commit is contained in:
2026-06-22 00:43:05 +08:00
parent d074a80cac
commit acae35700e
15 changed files with 31931 additions and 0 deletions
+57
View File
@@ -0,0 +1,57 @@
/*
* SewJoy Theme - Page Builder / Customizer Interaction
*/
(function ($) {
'use strict';
$(function () {
var $builder = $('.builder');
if (!$builder.length) {
return;
}
// Handle option button clicks.
$builder.on('click', '.builder-option', function (event) {
event.preventDefault();
var $button = $(this);
var component = $button.data('component');
var option = $button.data('option');
if (!component || !option) {
return;
}
// Deselect siblings within the same component group.
$builder
.find('.builder-component[data-component="' + component + '"] .builder-option')
.removeClass('selected');
// Mark the clicked button as selected.
$button.addClass('selected');
// Update the corresponding summary entry.
var $summaryValue = $('#summary-' + component + ' .builder__summary-value');
if ($summaryValue.length) {
$summaryValue.text(option);
}
});
// Optional: Add-to-cart button placeholder behavior.
$builder.on('click', '.builder__add-to-cart', function () {
var selections = {};
$builder.find('.builder-option.selected').each(function () {
var $btn = $(this);
selections[$btn.data('component')] = $btn.data('option');
});
if (Object.keys(selections).length === 0) {
console.warn('SEWJOY THEME: 请先选择组件选项');
return;
}
console.log('SEWJOY THEME: 加入购物车', selections);
});
});
})(jQuery);
+28
View File
@@ -0,0 +1,28 @@
/*
* SewJoy Theme - Main JavaScript
*/
(function ($) {
'use strict';
// Log on load
console.log('SEWJOY THEME 已加载');
// Document-ready functionality
$(function () {
// Smooth scroll for in-page anchors
$('a[href*="#"]:not([href="#"])').on('click', function (event) {
var target = $(this.getAttribute('href'));
if (target.length) {
event.preventDefault();
$('html, body').animate({
scrollTop: target.offset().top - 60
}, 600);
}
});
// Highlight current menu item visually
$('.main-navigation li.current-menu-item, .main-navigation li.current_page_item')
.addClass('active');
});
})(jQuery);