M
M
Mois2016-10-01 20:22:40
css
Mois, 2016-10-01 20:22:40

How do I package in Flexbox so that flex-basis changes when the browser resizes?

I have n images, fixed resolution, and they need to be set exactly as in the example, rubber:
ae219c5bf2c44db3809d6b3720d5ed8a.png
(scrolling is done horizontally)
When you open the page, everything is positioned correctly, in the right proportions and at the right intervals. But when the browser is resized, the width of the flex-basis column (because flex-direction: column) remains fixed. Well, this happens in all browsers except Firefox.
Once again:
1. When I open everything is fine
2. I resize the browser - everything is bad: I
0691814a7d634f788db89f1b64cf929e.png
update now at this scale, everything is restored:
c6245b59de534f979129070afdd0347f.png
Here is the code:
codepen.io/Mois-ilya/pen/amyWQr?editors=1100

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
fsockopen, 2016-10-01
@Mois

Here is the working JS code

window.onresize = function(event) {
  //console.log(document.querySelectorAll(".pic img")[0].style.height);
  var array = document.querySelectorAll(".pic");
  for (i = 0;i<array.length;i++){
    array[i].style.width = document.querySelectorAll(".pic img")[0].clientWidth + "px";
  }
};

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question