h1:hover ~ img {
transform: scale(1.1, 1.1);
}
$(function () {
$('.cena').each(function () {
$(this).text($(this).text().replace(/^\s*(\d+)(\d{3})\s*([а-я\.]+)?\s*$/, '$1 $2 $3'));
});
});
Provides access to all elements with an id. This is a legacy non-standard interface, you should use the Document.getElementById() method instead.
$(document).on('click', '.item', (function (e) {
$('.image', this).text('ok');
});
function AnyClass () {
return Object.apply(this, arguments);
}
console.log(new AnyClass({'a': 3, 'b': 7}));
console.log(new AnyClass(5));
console.log(new AnyClass(true));
console.log(new AnyClass('test'));
AnyClass.prototype = Object.create(Object.prototype);
$(function () {
var target = $('селектор_блока_для_вставки'),
index = 1;
$(window).on('scroll', function (e) {
var scroll = $(this).scrollTop();
if (/*Проверяем что-то*/) {
insert();
}
});
function insert () {
$.ajax({
url: index + '.html',
beforeSend: function () {
//Тут можно показать крутилку
}
}).done(function (data) {
target.append(data);
//target.html(data); //Если нужно не добавить, а заменить
index++;
stop();
}).fail(function () {
//Не вышло
stop();
});
function stop () {
//Тут крутилку останавливаем
}
}
});
var countName = [
'Петя',
'Вася'
];
for (var i = 0, data = []; i < countName.length; ++i) {
data.push({});
data[data.length - 1][countName[i]] = {
age: 10
};
}
for (var i = 0, data = []; i < countName.length; ++i) {
data.push(set(countName[i], 10));
}
function set (name, value) {
var object = {};
object[name] = {
age: value
};
return object;
}
for (var i = 0, data = []; i < countName.length; ++i) {
data.push(set(countName[i], 10));
}
function set (name, value) {
var object = {};
Object.defineProperty(object, name, {
value: {
age: value
}
});
return object;
}