Windows 8 Flexboxes - Nesting Flexboxes with overflow enabled

老子叫甜甜 提交于 2019-12-06 23:44:30

This is the final method I ended up using:

var groups = document.querySelectorAll(".inner-container");

for (var i = 0; i < groups.length; i++) {
  var group = groups[i];
  //The scroll width is the width of the actual content of our flex box. 
  //If we set the div's CSS width to the scroll width, the box will push other flex box elements correctly.
  group.style.width = group.scrollWidth + "px";
}

I believe that this should work in most cases, but I have not really tested it in any but mine. Once again, if anyone has a better solution, it would be interesting to see!

My problem was that i got a height and a contentBox which was to narrow.

My solution:

var groups = element.querySelectorAll('.contentBox');
for (var i = 0; i < groups.length; i++) {
    var group = groups[i];
    var tempwidth = 0;
    while (group.childNodes[1].scrollHeight > group.scrollHeight) {
        tempwidth = tempwidth + 100;
        group.childNodes[1].style.width = tempwidth + 'px';
    }
}    
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!