var elems = document.querySelectorAll('.scrollMouse');
for (var a = 0; a < elems.length; a++) {
var td = [...elems[a].querySelectorAll('table td')];
var first = td[0].offsetLeft;
var last = Math.max(...td.map(n => n.offsetLeft + n.offsetWidth));
var firstTd = td.filter(n => n.offsetLeft === first);
var lastTd = td.filter(n => n.offsetLeft + n.offsetWidth === last);
firstTd[firstTd.length - 1].classList.add('round-left-bottom');
lastTd[lastTd.length - 1].classList.add('round-right-bottom');
lastTd.forEach(n => n.classList.add('border-right'));
}
function название_функции_шорткода(){
if( is_home() ) {
return title();
}
код функции
}
от
если
<div class="scrollMouse"><table></table></div>
просто когда я так пишу, то у меня в консоли ошибка:
Uncaught TypeError: Cannot read property 'offsetLeft' of undefined
жалуется на строку:
var first = td[0].offsetLeft;