если я пишу что то одно, то ошибка
- blocks.left()
-
if (blocks.left) {
blocks.left()
}
- blocks.left && blocks.left()
. var delayAnim = 4; <...> 'animation-delay': '.' + delayAnim + 's'
'animation-delay': (delayAnim + 0.2 * index) + 's'
удаляются последовательно только теги tr <...> вложенные теги td остаются
table.appendChild(tr); <...> table.appendChild(tdLeft); // "Название" table.appendChild(tdRight); //"Описание" table.appendChild(tdDelete); //"Навигация"
filters: {
shorten: (val, words = 2) => val.split(' ').slice(0, words).join(' '),
},
<div>{{ text | shorten }}</div>
<div>{{ text | shorten(5) }}</div>
watch: {
'$route.query.page'() {
this.loadCustomers();
},
},
watch: {
'$route.query.page': {
immediate: true,
handler: 'loadCustomers',
},
},
нужного функционала нет <...> Сталкивался может кто с подобным и нарыл хорошую обертку для API?
сделатьКрасиво
, и вам самому не надо работать ни головой, ни руками? Нет, такого нет и не будет.if (coord.every((n, i) => n === coordinates[i])) {
placemark.balloon.open();
}
const placemarks = elem.find('.map-balloonContent').get().map(n => createPlacemark({
coord: $(n).data('coord'),
content: $(n).html(),
}));
placemarks.forEach(n => myMap.geoObjects.add(n));
placemarks[0].balloon.open();
elem.on('clickAddress', function(e, coord) {
placemarks.find(n => n.geometry.getCoordinates().every((m, i) => m === coord[i])).balloon.open();
});
function getWinCount(team) {
const el = Array.prototype.find.call(
document.querySelectorAll('.table-item__name'),
n => n.textContent === team
);
return el ? +el.closest('tr').children[3].textContent : null;
}
const wins = getWinCount('Уфа');
Мой браузер не поддерживает ES-2015
function getWinCount(team) {
var teams = document.querySelectorAll('.table-item__name');
for (let i = 0; i < teams.length; i++) {
var el = teams[i];
if (el.textContent === team) {
while ((el = el.parentNode).tagName !== 'TR') ;
return +el.children[3].textContent;
}
}
return null;
}
$('.container').find('h2, h3').each(function(i) {
text = $('.select-list li a').eq(i).text();
не надо код, подскажите алгоритм
function shorten(val) {
if (val <= 10000) {
return val.toString();
}
const thousands = val / 1000;
const rounded = Math.round(thousands);
const deviation = Math.sign(thousands - rounded);
return `${[ '≈', '', '>' ][deviation + 1]}${rounded} т.`;
}
Цена завернута в див price prc-new
$('[name="variant"] option:checked').data('price')
$('.price.prc-new span').text()
$('input').on('input', function() {
$(this).val((i, v) => Math.max(this.min, Math.min(this.max, v)));
});
document.querySelector('input').addEventListener('input', ({ target: t }) => {
t.value = Math.max(t.min, Math.min(t.max, t.value));
});
$('.price').text((i, text) => {
const [ price, currency ] = text.split(' ');
return `${(+price).toLocaleString()} ${currency}`;
});
// или
document.querySelectorAll('.price').forEach(n => {
n.textContent = n.textContent.replace(/\d(?=(\d{3})+\D)/g, '$& ');
});