Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic content not work #6

Closed
BonBonSlick opened this issue Jan 8, 2020 · 3 comments
Closed

Dynamic content not work #6

BonBonSlick opened this issue Jan 8, 2020 · 3 comments

Comments

@BonBonSlick
Copy link

BonBonSlick commented Jan 8, 2020

e-oj/Magic-Grid#40

Same here with vue

Also, this one package does not update and rerender positions when new items loaded.

@BonBonSlick
Copy link
Author

BonBonSlick commented Jan 8, 2020

Adding new event helps a little, but not much. Elements repositioned not right


  methods: {
    waitUntilReady () {
      if (this.isReady()) {
        this.positionItems()

        window.addEventListener('resize', () => {
          setTimeout(this.positionItems(), 200)
        })
        window.addEventListener('scroll', () => { // HERE
       this.positionItems()
   setTimeout(this.positionItems(), 200)
        })
    },

Images overflow each other or in open space, 1 per 1000 pixels

@BonBonSlick
Copy link
Author

BonBonSlick commented Jan 8, 2020

When a new pack of images loaded, they positioned wrong. But works perfectly for static. Calling positionItems() does not help for wrong positioned elements. Maybe some additional css should be applied.

@BonBonSlick
Copy link
Author

BonBonSlick commented Jan 8, 2020

Hard to track it down, somewhere here wrong calculations


  Array.prototype.forEach.call(this.items, (item, i) => {
        let min = this.nextCol(cols, i)
        let left = min.index * this.colWidth() + wSpace

        item.style.left = left + 'px'
        item.style.top = min.height + min.top + 'px' // I think this one has errors

        min.height += min.top + item.getBoundingClientRect().height
        min.top = this.gap
      })

It uses positions which are already busy.
If it is going to put newly downloaded images there, it should move old images somewhere else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant