question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Images overlaping

See original GitHub issue

Hi there,

I have problem of image overlaping, (like this issue https://github.com/shershen08/vue-masonry/issues/9, but i have no plugin) it’s because items change sizes at the same time as the images loads

I saw this :

  mounted: function(){
    this.$redrawVueMasonry();
  },

But there is always a problem, because this doesn’t matter when items change size when the page is loading 😦

It’s possible to fix the problem to use the on progress method of masonry (imagesLoaded - https://masonry.desandro.com/layout.html#imagesloaded) ?

imagesLoaded( grid ).on( 'progress', function() {
  // layout Masonry after each image loads
  msnry.layout();
});

Thanks for help

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
rotemrevivo91commented, May 21, 2019

I have the same problem. My solution is to wait for a promise for 950ms (smallest interval that worked for me) and then redraw the masonry layout. The time delay is so small that it’s literally unnoticeable.

mounted(){
	this.onLoad()
},
methods:{
	async onLoad(){
		await this.sleep(950)
		this.$redrawVueMasonry()
	},
	sleep(ms){
  		return new Promise(resolve => setTimeout(resolve, ms))
	}
}
2reactions
chakflyingcommented, Apr 20, 2020

Came up with an alternative solution for if you know how many images you are loading:

template

<div v-masonry="'my_thing'" transition-duration="1s">
      <div v-masonry-tile>
          <img :src="item"
            @load="imageLoaded"
          />
      </div>
</div>

script

data() {
  return {
      imagesloaded: 0
    }
  },
methods: {
    imageLoaded() {
      this.imagesloaded += 1
      if (this.imagesloaded === this.items.length) {
        this.$redrawVueMasonry('my_thing')
      }
    }
  }

I don’t know why ‘my_thing’ has to be wrapped as a string in both places, but it doesn’t seem to work otherwise.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Overlay images online (no upload) - Free tool
Quick online tool to overlay images with transparent adjustment. Select your image in tool and add overlay image, then adjust overlay image to...
Read more >
Overlay images online - PineTools
Overlay or merge two images, choose the position of the images, the new size, the rotation and the composite method. Main image.
Read more >
Overlay Images: Add Picture to Picture Online for Free - Fotor
You can overlay two images to create dazzling pictures for free using Fotor online photo editor. To superimpose images, first, click the button...
Read more >
Overlapping Image - an overview | ScienceDirect Topics
Identify overlapping image features in multiple feature extraction libraries. ... robot provides a true 3D image based on overlapping images (Figure 4-1).
Read more >
Overlapping Pictures | Download Free Images on Unsplash
Download the perfect overlapping pictures. Find over 57 of the best free overlapping images. Free for commercial use ✓ No attribution required ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found