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.

Image is not visible if its parent is styled as `overflow: hidden`

See original GitHub issue

If the parent of the image is styled as overflow: hidden, the image will not be visible. Needs to find a way to ignore overflow: hidden.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
jimbluecommented, Oct 13, 2017

@kingdido999 I’m not sure onBeforeOpen and onClose events are mentioned in the doc, I didn’t see them.

Anyway, they could help with this problem, so here is my idea:

HTML

<html>
    <body class="overflow_x">
       // body content here
    </body>
</html>

JS

new Zooming({
   onBeforeOpen: () => {
      document.body.classList.remove('overflow_x')
    },
    onClose: () => {
      document.body.classList.add('overflow_x')
    }
})

CSS

body.overflow_x {
  overflow-x: hidden;
}

I didn’t test this solution for know…

Cheers

0reactions
HunterGraubardcommented, Apr 19, 2018

@jimblue This solution looks interesting. But as you said, the documentation on the event seems lacking.

Do the events pass anything to the handler function? In my case, I have overflow: hidden on the immediate parent around the image. I have <a><img /></a>, where overflow: hidden is on the <a> tag. If the event handler has access to the img element, then I could just remove the overflow style on the parent a element. Can anyone help with this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

center image inside overflow-hidden-parent - css
Save this question. Show activity on this post. I have an image inside a span tag, the span has a set width and...
Read more >
overflow - CSS-Tricks
The overflow property controls what happens to content that breaks outside of its bounds: imagine a div in which you've explicitly set to...
Read more >
overflow - CSS: Cascading Style Sheets - MDN Web Docs
visible. Content is not clipped and may be rendered outside the padding box. hidden. Content is clipped if necessary to fit the padding...
Read more >
Only hide CSS overflow on a single x or y axis, or ignore it
The solution is simple, if not a little bit hacky. Wrap the container in another div. <style> .wrapper { height: 50px; width: 50px;...
Read more >
How to prevent overflow scrolling in CSS - LogRocket Blog
With the auto value, the content that is not visible in the viewport is hidden, and scroll bars are introduced so the expanded...
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