Converting absolute layout to use floats

后端 未结 7 2113
予麋鹿
予麋鹿 2021-02-01 05:23

I’m looking for some advice on a project I am working on and would be appreciative of any assistance.

Aim:

To make a drag and drop CMS which allows a user to d

相关标签:
7条回答
  • 2021-02-01 05:51

    This is what I would to devise a system that automagically does that:
    (pseudo code, mostly)

    1. get window.width and window.height of what user is visualizing on his screen
    2. calculate a percentage for every element with a simple formula:

      var elWidth = (element.width / window.width) * 100
      var elHeight = (element.height / window.height) * 100

    3. get every element that is not 100% width to behave like an inline element with
      display:inline-block;

    This should be a good base to start with, provided that you designed a good UI to derive every nested DIV and a sort of "magnetic" grid to align the items.

    What do you think?

    0 讨论(0)
提交回复
热议问题