componentDidUpdate(prevProps) {
if (!_.isEqual(prevProps.data, this.props.data)) {
this.props.loadData();
}
}
e.preventDefault();
link.addEventListener('click', function (e) {
e.preventDefault();
});
link.addEventListener('click', function (e) {
this.href = 'example.com';
});
({
shouldDeps: [
{ elem: 'control'},
{ elem: 'content'},
{ mods: { action: 'article'} },
{ block: 'modal', mods : { theme : 'islands', autoclosable : true }},
'button',
'content',
'menu',
{ block: 'i-bem', elem: 'dom' }
]
}, { tech: 'js', mustDeps: { elem: 'content', tech: 'bemhtml' } })
$('.elem-exp .js-svg-bar').countTo({
to: 70,
speed: 1000,
onUpdate: function (value) {
$(this).attr('percent', value);
}
});
matcher: function(item) {
var lowerCase = function (s) {
return s.toLowerCase();
};
var searchWords = this.query.split(' ').map(lowerCase);
var sourceWords = item.split(' ').map(lowerCase);
var result = sourceWords.filter(function (source) {
var found = searchWords.filter(function (w) {
return source == w;
});
return found.length > 0;
});
return result.length == searchWords.length;
}
function addToCart(id, count) {
var cart = localStorage.getItem('christGoods');
cart = JSON.parse(cart) || {};
cart[id] = cart[id] || 0;
cart[id] += count;
localStorage.setItem('christGoods', JSON.stringify(cart));
}
function getCart() {
var cart = localStorage.getItem('christGoods');
cart = JSON.parse(cart) || {};
return cart;
}
addToCart('001', 2);
getCart();
// Object {001: 2}
'background-image': 'images[currentImage]'
на 'background-image': images[currentImage]