Что не так в следующем коде?Динамическое отображение полосы прокрутки
Мне нужно определить и установить ширину 1 элемента на основе, если в другом элементе есть полоса прокрутки или нет. это, кажется, не работает:
console.log("print Scroll..here...");
if(($(".printer-details-container").offsetHeight < $(".printer-details-container").scrollHeight) || ($(".printer-details-container").offsetWidth < $(".printer-details-container").scrollWidth)){
// your element have overflow
console.log("print Scroll..here...");
$(".printer-header").css({"width":"96.9999%;"});
}
else{
//your element don't have overflow
console.log("no print Scroll..here...");
$(".printer-header").css({"width":"100%;"});
//console.log($(".printer-header").print-header.css({"width":"100%;"});
}
Что именно не работает? Можете ли вы предоставить скрипку? – Rayon
Состояние не работает, и мы не видим настройки ширины! – Smitha