Issue: Background image is not displaying correctly on the .bg class element

Looking to implement a parallax scrolling effect on the .intro-body section of my homepage, similar to what I have successfully achieved on the jumbotron images of my 'About', 'Resume' and 'Portfolio' pages. However, I'm facing an issue where the background image isn't displaying when applied to the .bg class. The images render correctly on other pages; the only distinction is that I'm using #intro before .bg to style this image to fit the entire screen's height and width.

The CSS property background: in the provided fiddle below shows an image, but I haven't been able to replicate the same result on my website:

Check out the fiddle here

I've spent around 3 hours searching on SO for a solution without success. Any insights or ideas are greatly appreciated. Thank you!

Visit My Homepage

HTML

<header class="intro" id="intro">
<div class="bg"></div>
    <div class="intro-body">
        <div class="container">
            <div class="row">
                <div class="col-md-8 col-md-offset-2">
                    <h1 class="brand-heading">Jon Howlett</h1>
                    <p class="intro-text">Aspiring web designer<br/>&amp;<br/>front-end developer</p>
                    <a href="#summary" class="btn btn-circle page-scroll">
                        <i class="fa fa-angle-double-down animate">    </i><span class="zero">Button Down</span>
                    </a>
                </div>
            </div>
        </div>
    </div>
</header>

CSS

#intro .bg {
background: url("https://upload.wikimedia.org/wikipedia/common/5/57/LA_Skyline_Mountains2.jpg") no-repeat scroll center bottom / cover;
background-size: cover!important;
position: fixed;
width: 100%;
height: 1000px;
top:0;
left:0;
z-index: -1;    
}

.intro-body {
width: 100%;
height: auto;
padding: 100px 0px;
text-align: center;
color: #FFF;
background: transparent;
}

Answer №1

The .bg div has an inline style with height:0px;.

If I include

background: #000 url("images/intropage_mountains.jpg") no-repeat scroll center bottom / cover;
in the .bg div and remove the inline style, the background image will display.

It seems like a JavaScript file is responsible for applying this inline style.

By changing the class to something like bg_main, the inline style disappears and the background image functions correctly.

EDIT*: I noticed that there are two versions of jQuery being used:

http://code.jquery.com/jquery-2.1.4.min.js

and

http://www.jonhowlett.uk/js/jquery.js

I recommend keeping only the latest version as using multiple jQuery resources may lead to conflicts in your code.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the process of defining a driver in Python in order to interact with a website

I have a task in my app that requires using Selenium to complete various functions. I am familiar with defining a driver and opening a webpage, but I need assistance regarding setting up the driver for an open net tab. Can anyone provide guidance on this ...

What is the best way to create this specific layout using CSS?

Describing a layout with fixed lengths at the edges and a fluid main content container. I'm struggling to achieve it and can't figure out why. Check out my jsfiddle http://jsfiddle.net/JyXtR/3/ for reference. I aim to achieve this desired layou ...

Twitter Bootstrap 3 - Change column order for extra small screens

My Twitter Bootstrap layout consists of two columns structured like this: <div class="col-md-4 col-sm-6 col-xs-12"> <div class="post"> Content here </div> </div> <div class="col-md-8 col-sm-6 col-xs-12"> <di ...

Is it possible to produce data on the server and then transmit it to the client?

Can you provide guidance on creating a webpage that prompts a python script to run on the server, and then displays the output of the script back in the browser? I'm put time into researching and seeking assistance during my web programming course. A ...

List of dropdown options retrieved from SQLite database

I am attempting to retrieve data from an SQLite database table in order to populate a dropdown menu list. My thought process is outlined below. The main issue I am facing is how to integrate the JS function with the HTML section. HTML.html <label ...

Setting a specific width for columns when utilizing more than 12 columns in a row in Bootstrap 3

Utilizing bootstrap 3 in this particular case. I currently have an HTML table with more than 12 rows, about 14 in total. These rows consist of various input controls such as textboxes and dropdowns. My goal is to set a fixed width for each column, for exa ...

Changing the MIME type from "application/octet-stream" to "video/mp4" in HTML5: A Step-by-Step Guide

<!DOCTYPE html> <html> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> </head> <body> <video id="video" controls src="${maps.url }" height="598" width="782"> ...

JavaScript - Sending Form Data with Local Time

I want to automatically submit a form at a specific time of day The form should be submitted every day at "15:30:00" Here is the JavaScript code I have written: <script type="text/javascript> function initClock() { var now = new Date(); var h ...

Remove the excess white space surrounding the header background image on the website above the fold

How do I eliminate the white spaces on the left, right, and top of my background image that covers the header area above the fold on my webpage? I am currently testing in Google Chrome and using VS Code as my editor. html, body { width: 100%; height: ...

Overflow issue with floating labels in Bootstrap 5 within a grid container

Incorporated within this code snippet are floating selects placed inside a bootstrap grid: <link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d4b6bbbba0a7a0a6b5a494e1fae7fae7">[emai ...

Discover the secret sauce to effortlessly adding text upon hovering over a button

I am completely new to CSS and only know the basics. Recently, I stumbled upon this code online that creates a button. However, I want to use an image inside the button, add a color overlay when hovered, and display text saying "LEARN MORE" upon hovering ...

The error messages for validations are not appearing as expected in the display

I'm encountering an issue with my MVC Kendo window control where form validation doesn't seem to be working. Although I can see the model state as false in the controller, the view isn't displaying any error messages. It's important to ...

Attempting to fill a collection of JSON entities through a GET call?

When handling a GET request that contains a list of JSON objects, I want to display the data in an input field on the screen using ng-model for data binding. The structure of the JSON get request is as follows: [{"make":"Mahindra","vin":"1987","model":"XU ...

Preloading videos for optimal performance on mobile devices

Looking for a solution where 4 MP4/video files, each 5MB in size, can be played consecutively without gaps between them on all browsers and devices. Preferably not looking for a solution involving the replacement of video source files. The current approac ...

Having trouble getting the show/hide div feature to work in a fixed position on the

Trying to show/hide a div using jQuery isn't working when the div is wrapped in a position:fixed element. However, changing it to position:relative makes the show/hide function work again. You can see an example of the working version with position:r ...

Why won't the display: block CSS style apply to my div element?

Take a look at my code: https://jsfiddle.net/r62p4209/ I created a search bar with company brand name and some buttons on the right, positioned in the center. My aim is for the search bar (from "search by:" to the "Go!" button) to move onto the next lin ...

Most efficient method to upload numerous images without any lag

I have a website where images are loaded only when they are slightly below the viewport. This method allows the site to load initially without images and then determine which ones need to be loaded based on the user's viewpoint. When a user scrolls ...

CSS file unable to be retrieved by the server

I am using the lampp server on Linux. My homepage, home.php, is saved inside the htdocs folder which also contains a css folder with all the necessary CSS files. A snippet of my home.php file includes HTML code without PHP embedded yet. <html> <h ...

Utilizing a function to populate an attribute using .attr() in d3

I utilize .attr to generate link paths in D3, as demonstrated in Lines 42 of the live demo: link.each(function (d){}) .attr('x1', function (d) { return d.source.x; }) .attr('y1', function (d) { return d.source.y; }) .a ...

Navigation menu consist of two horizontal rows

I'm facing a challenge. I have a total of 8 links (one being a button) on a navigation menu that I need to display in two rows on the right side. I'm having difficulty aligning them properly while also justifying them to the right. Essentially, t ...