$dec = function() {
...
};
$hex = function() {
...
};
<button>click me</button>button {
background: green;
}
@keyframes xxx {
0% { background-color: red; }
100% { background-color: transparent; }
}
.xxx {
animation: xxx 2s;
}$('button').on({
click() {
$(this).addClass('xxx');
},
animationend() {
$(this).removeClass('xxx');
},
});
for (var i = 0; i < 10; i++) {
setTimeout(function() {
alert(+this);
}.bind(i), 100);
}for (let i = 0; i < 10; i++) {
setTimeout(function() {
alert(i);
}, 100);
}for (var i = 0; i < 10; i++) {
setTimeout(alert, 100, i);
}for (var i = 0; i < 10; i++) {
setTimeout(new Function(`alert(${i})`), 100);
}for (var i = 0; i < 10; i++) {
setTimeout(function() {
alert(i++);
}, 100);
}
i = 0;
All animated properties should be animated to a single numeric valueanimate должен (так мне кажется) вызываться только для того элемента, на котором случилось событие, а не для всех - для этого селектор надо заменить на event.target или this.$(document).ready(function() {
$('a').mouseenter(function() {
$(this).animate({
backgroundPositionX: -200,
backgroundPositionY: 50,
}, 900);
});
});
$('body').on('click', function(e) {
var
$target = $(e.target),
isMark = $target.hasClass('mark'),
isActive = $target.hasClass('active');
if (!isMark || !isActive) {
$('.mark.active +.tooltip').fadeOut();
$('.mark.active').removeClass('active');
}
if (isMark && !isActive) {
$target.addClass('active');
$('.mark.active +.tooltip').fadeIn();
}
});
он не работает
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hConsole, color);
SELECT `date`
FROM `foo`
WHERE `id` >= (
SELECT `id`
FROM `foo`
WHERE `date` < now()
ORDER BY `id` DESC
LIMIT 1
)
SELECT t2.s1
FROM (
SELECT
t1.id,
t1.s1,
IF (@max = 1, @max := t1.seq, @max := @max) AS "max1",
IF (t1.seq = 1, @max := 1, @max := @max) AS "max2"
FROM (
SELECT
(SELECT @id := @id + 1) AS "id",
s1,
IF (s1 = @prev + 1, @seq := @seq + 1, @seq := 1) AS "seq",
(SELECT @prev := s1) AS "prev"
FROM `table`,
(SELECT @id := 0, @seq := 0, @prev := null) AS init
) AS t1,
(SELECT @max := 1) AS init
ORDER BY t1.id DESC
) AS t2
WHERE t2.max1 >= 3
ORDER BY t2.ids1 | n
1 3
2 3
3 3
7 1
12 1
22 2
23 2
5 4
6 4
7 4
8 4SELECT s1 FROM `table` WHERE n > 2
<div data-num="2350" data-step="5" class="number">0</div>$(window).scroll(function() {
var $win = $(window);
if ($('#counter').offset().top < $win.scrollTop() + 200) {
$win.off('scroll');
$('.number').addClass('viz').each(function() {
var
i = 0,
num = +this.dataset.num,
timeStep = 1000 / num,
valStep = +this.dataset.step || 1,
interval = setInterval(function($el) {
if ((i += valStep) >= num) {
clearInterval(interval);
}
$el.html(Math.min(i, num));
}, timeStep, $(this));
});
}
});var steps = 100;
$(window).scroll(function() {
var $win = $(window);
if ($('#counter').offset().top < $win.scrollTop() + 200) {
$win.off('scroll');
$('.number').addClass('viz').each(function() {
var
i = 0,
num = +this.dataset.num,
valStep = num / steps,
interval = setInterval(function($el) {
if ((i += valStep) >= num) {
clearInterval(interval);
}
$el.html(Math.floor(Math.min(i, num)));
}, 20, $(this));
});
}
});