28 lines
782 B
JavaScript
28 lines
782 B
JavaScript
/*
|
|
* 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); |