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.

gatsby-image renders images on top of a fixed navbar

See original GitHub issue

Summary

gatsby-image renders images on top of a fixed navbar when scrolling down the page. When using ordinary html <img>, this issue does not occur.

For troubleshooting, I’ve set the z-index of the navbar to 1000, but this does not solve the issue.

You can check the actual behavior by visiting the live test site. Note that the “Services” section uses gatsby-images and the “About” section uses ordinary html img, so you can see the difference.

For testing and having a look at the actual code, you can clone the repository here.

Environment

System:
    OS: Linux 4.19 Debian GNU/Linux 9 (stretch) 9 (stretch)
    CPU: (4) x64 Intel(R) Core(TM) i5-4690 CPU @ 3.50GHz
    Shell: 4.4.12 - /bin/bash
  Binaries:
    Node: 10.17.0 - /usr/bin/node
    npm: 6.11.3 - /usr/bin/npm
  Languages:
    Python: 2.7.13 - /usr/bin/python
  Browsers:
    Firefox: 71.0
  npmPackages:
    gatsby: ^2.18.12 => 2.18.12
    gatsby-background-image: ^0.9.12 => 0.9.12
    gatsby-image: ^2.2.37 => 2.2.37
    gatsby-plugin-react-helmet: ^3.1.18 => 3.1.18
    gatsby-plugin-sharp: ^2.3.10 => 2.3.10
    gatsby-source-filesystem: ^2.1.43 => 2.1.43
    gatsby-transformer-sharp: ^2.3.9 => 2.3.9
  npmGlobalPackages:
    gatsby-cli: 2.8.16

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
nicgutierrezcommented, Jan 9, 2020

If you add z-index: 10 to your BackgroundImage in the header component you fix the issue: https://github.com/cheomanigua/gatsby-issue/blob/master/src/components/header.js#L21

0reactions
samzmanncommented, Jun 13, 2020

@cheomanigua Got it, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating responsive navbars with background images in ...
The way I decided to implement it was simple, first create an absolute positioned container to display the image and then a second...
Read more >
Gatsby Image plugin
The Gatsby Image plugin includes two components to display responsive images on your site. One is used for static and the other for...
Read more >
All The Dumb Mistakes I Made Building My First Gatsby Site
Gatsby is great, but there's a lot to learn about in the Gatsby ecosystem. Check out mistakes to avoid when building your first...
Read more >
StaticImage not showing up in test render in Gatsby
import React from 'react'; import { StaticImage } from 'gatsby-plugin-image'; import Test from '../Test/Test'; const NavBar: React.
Read more >
The top choices for React lazy loading libraries in 2021
Below are some of the benefits of gatsby-image in your React application: It can be optimized for images with fixed height and width;...
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