const date = new Date(); // текущая дата
const dayOfWeek = date.getDay();
if (dayOfWeek === 0) {
dayOfWeek = 7; // делаем воскресенье не первым днем, а седьмым
}
date.setDate(date.getDate() + (7 - date.getDay())); // добавляем к текущей дате кол-во оставшийся в этой неделе дней
date.setHours(23, 59, 59); // устанавливаем время
const dateString = date.getFullYear() + '/' + ('0' + (date.getMonth() + 1)).slice(-2) + '/' + ('0' + date.getDate()).slice(-2) + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();
alert(dateString); // вывод
var delayAnim = 4; <...> 'animation-delay': '.' + delayAnim + 's'
'animation-delay': (delayAnim + 0.2 * index) + 's'
<input class="date">
<input class="date">
<input class="date">
const yearButton = year => `
<button
data-year="${year}"
class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all"
>${year}</button>
`;
$('.date').datepicker({
showButtonPanel: true,
}).each(function(i) {
$(this).datepicker(
'option',
'currentText',
`Today ${yearButton(2015 + i * 2)}${yearButton(2015 + i * 2 + 1)}`
);
});
$(document).on('click', '[data-year]', function() {
$.datepicker._curInst.input.datepicker('setDate', `01/01/${$(this).data('year')}`);
});
function timer1Func() {
timer1 = setInterval(function() {
// выполняется действие первого таймера
console.log("1 таймер сработал")
timer2Func()
}, 4000);
}
function timer2Func() {
timer2 = setTimeout(function() {
// выполняется действие второго таймера
console.log("2 таймер сработал")
}, 2000);
}
var timer1;
var timer2;
function timer1Func() {
timer1 = setTimeout(function() {
console.log('1st timer fired');
timer2Func();
}, 4000);
}
function timer2Func() {
timer2 = setTimeout(function() {
console.log('2nd timer fired');
timer1Func(); // Если не нужна цикличность, то удалите эту строчку.
}, 2000);
}
timer1Func();
function section_html(){
require "section.php";
}
function show_section(){
section_html();
}
add_shortcode( 'show_section', 'show_section' );
[show_section]
get_template_part( 'section' );
подключит section.php. font-variation-settings: "wdth" 75;
$('.js-line-wave').on('mouseenter, mousemove', function(e) {
// Здесь расчитывается относитеьное положение курсора чтобы от него считать синус
var offset = $(this).offset();
var relativeX = (e.pageX - offset.left);
var relativeY = (e.pageY - offset.top);
$('.line, .button_wave, .line_item').each(function(index, letter) {
var posx = index;
// Здесь нужно править магические числа, например вместо 352 надо ставить ширину элемента
//и ещё нужно править частоту волны и амплитуду, но я забыл формулы
var posy = Math.sin((index / 10 + relativeX / 352) * 180 / Math.PI) * 30 - 20;
// Здесь происходит применение синуса только к 30 элементам слева и справа от мышки
if ($(letter).position().left > relativeX - 30 && $(letter).position().left < relativeX + 30) {
$(letter).css("transform", "translateY(" + posy + "px)");
} else {
$(letter).css("transform", "translateY(" + 0 + "px)");
}
});
});