0
以下代碼有什麼問題?動態檢測滾動條
我需要根據其他元素是否有滾動條來檢測和設置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