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.

Cannot get this to work inside of my component...

See original GitHub issue

Soooo, I can get this to work with a basic image with basic CSS, like so:

progressive-img {
  width: 100%;
  height: auto;
}

…but I cannot seem to get it to work with more specific CSS inside of a custom vue component. the image simply does not show up at all.

Can you see anything in this CSS that might be causing an issue with the plugin?

This is the CSS of the parent component:

.component {
  width: 100%;
  height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  background: url(../../assets/images/logos/arrow-favicon-blue-10-percent.svg) no-repeat center 25vh, #091830;
}

and here is the CSS of the progressive-image, which is a child of the parent .component:

progressive-img {
  width: 100vw;
  height: calc(100vh - 48px);
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  object-fit: cover;
  z-index: 1;
}

@media screen and (orientation: landscape) {
  progressive-img {
    width: 70vw;
    height: 100vh;
  }
}

Please let me know if you see anything, or if you need any more information to understand better. I looks like the image tries to load by flickering for a split second, but then it’s gone, if that helps at all.

…I think it’s almost there! XD

R

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
MatteoGabrielecommented, Sep 27, 2017

you might want to use progressive-background for this, the progressive-img it maintains a responsive aspect ratio, that’s why doesn’t fit completely and also remember that when you add the object-fit property to your .progressive-image class, you are not actually targeting an img tag, but a bunch of divs and an image tag somewhere inside that structure: make sense that doesn’t work 😃

0reactions
MatteoGabrielecommented, Sep 27, 2017

@rchrdnsh thanks a lot 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to access React instance (this) inside event handler
this.changeContent needs to be bound to the component instance via this.changeContent.bind(this) before being passed as the onChange prop, otherwise the ...
Read more >
Bug: too hard to fix "Cannot update a component from inside ...
It's setState on other components that are bad. You can't detect those statically.
Read more >
Rules of Hooks - React
Don't call Hooks inside loops, conditions, or nested functions. Instead, always use Hooks at the top level of your React function, before any...
Read more >
REACT – Simple Intro Component Not Rendering?
render(<App />,mainNode);. But mainIntro isn't loading for some reason. Let's take a closer look at what's happening. Naming your components.
Read more >
Understanding common frustrations with React Hooks
Editor's note · “React Hook cannot be called inside a callback” · “React Hooks must be called in a React function component or...
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