I want to set a single background image for all slides in fullPage.js. How can I achieve this

I am attempting to replicate a similar effect as shown in this example:

The demonstration above utilizes the fullPage.js plugin. You may have noticed how the background image remains consistent while navigating through different sections.

I have searched for examples and studied the documentation of the plugin but have not found any information on achieving this specific feature.

Currently, all I can do is add the same background image to all slides, but during transition between slides, the change of background images is noticeable.

I attempted to create a new div with an ID placed above the slides, however, this method did not yield the desired result.

DEMO https://jsfiddle.net/55euzL32/2/

HTML

<div id="fullpage">
    <div id="bg"></div>
    <section id="section1" class="section">
        <div class="container">
            <div class="col-md-12 text-center">
                <h1>Bootstrap 3 + fullpage.js<br>
                    <small>A working example of the pairing.</small>
                </h1>
                <p>Scroll down to move from section to section. The vertical pagination will adjust accordingly. This is powered by <a href="https://alvarotrigo.com/fullPage/">fullpage.js</a> and is pretty impressive.</p>
            </div>
        </div>
    </section>
    <section id="section2" class="section">
        <div class="container">
            <div class="col-md-12 text-center">
                <p>Section 2</p>
            </div>
        </div>
    </section>
    <section id="section3" class="section">
        <div class="container">
            <div class="col-md-12 text-center">
                <p>Section 3</p>
            </div>
        </div>
    </section>
</div>

CSS

#bg {
    position: fixed;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    background: url('../img/bg/bg.jpg') no-repeat 50% 50%;
    background-size: cover;
    z-index: -3;
    -webkit-filter: grayscale(1);
    filter: grayscale(1);
}

JS

$(document).ready(function() {
    $('#fullpage').fullpage({
        navigation: true,
        animateAnchor: true,
        parallax: true,
        parallaxOptions: {type: 'reveal', percentage: 62, property: 'translate'},
        lazyLoading: true
    });
});

Answer №1

To enhance the appearance of your webpage, consider adding a background to the body element and apply the style background-position: fixed.

Check out the latest changes on your updated Fiddle.

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

React app experiencing inconsistent loading of Google Translate script

In my React application, I have integrated the Google Translate script to enable translation functionality. However, I am facing an issue where the translator dropdown does not consistently appear on every page visit. While it sometimes loads properly, oth ...

Ajax Post Response Redirect

I seem to be facing a major issue with redirecting my ajax response for reasons that are beyond my comprehension. Can anyone provide assistance? Below is the code snippet in question: (function($){ function processForm( e ){ $.ajax({ ...

When floated to the right, the element is being pushed onto the next line in Firefox

Within a div, there are four elements. I specifically want the last element to be positioned on the far right, so I applied float: right to it. However, in Firefox, the last element gets pushed to the end of the next line instead. This issue does not occ ...

executing a hook within _app.tsx in Next.js

The issue I'm facing involves the rendering of a hook that helps determine if my components are within the screen's view to trigger animations. This hook is executed in _app.tsx, however, it doesn't run when switching to another page. Oddly ...

Managing Image Quality with Unsplash API

How can we ensure high quality images are embedded on the web using Unsplash API or other methods? The image displayed in the example below appears blurry and unclear compared to the original image. Original Image link: Example of embedding the image abo ...

Discord.js: Merging strings while pushing to an array

I am currently updating an embed message to notify users who have "enlisted" in a list by reacting. However, I am encountering an issue where the strings from the entire array are getting combined when the length of the array reaches 2 before adding a new ...

Arrange Drifting Components in a Fluid Layout Grid

I am in the process of creating a unique sticky note website where I want to arrange the notes in a grid format. As the window size decreases, the notes should automatically reorganize to fit the width and allow for vertical scrolling. My goal is to achiev ...

Animation of two divs stacked on top of each other

I am trying to replicate the animation seen on this website . I have two divs stacked on top of each other and I've written the following jQuery code: $('div.unternehmen-ahover').hover( function () { $('div.unternehmen-ahover' ...

No space left around the image's border

Whenever I apply a border to an image, it comes with a margin and the image itself receives white padding. How can I remove the margin from the border? This is how I currently have it: border: 1px solid gray; ...

Angular - Electron interface fails to reflect updated model changes

Whenever I click on a field that allows me to choose a folder from an electron dialog, the dialog opens up and I am able to select the desired folder. However, after clicking okay, even though the folder path is saved in my model, it does not immediately s ...

Unexpected issue with Ajax call execution

I am facing an issue with my ajax call as it is not behaving as expected. The browser is throwing an error message saying "jquery-1.10.2.js:8157 Uncaught TypeError: Cannot read property 'FileGuid' of undefined". I have set breakpoints in my CS fi ...

Utilize Moment.js in AngularJS for formatting dates

I have been attempting to use moment.js in Angularjs to format a date, but it seems like I am running into some issues. Here is the link to my code snippet on jsfiddle http://jsfiddle.net/sed6x5e8/ and below you can find the HTML and JS code that I am work ...

Ways to prevent other users from clicking or modifying a particular row

I have a data table in my project that will be accessed by multiple users simultaneously. My requirement is that once a row is selected and edited by one user, it should become unclickable for other users who are also viewing the same page or data table. ...

Ways to incorporate a loading feature in javascript, jquery, and php as it runs?

I have created a form that, when clicked on, returns a value within the page. Below is my form. When the form is submitted, it takes some time to process. I would like to display a loading message while the code is being executed. Here is my form: <ht ...

Pattern for either one or two digits with an optional decimal point in regular expressions

Currently, I'm utilizing for input masking. I am specifically focusing on the "patterns" option and encountering difficulties while trying to create a regex expression for capturing 1 or 2 digits with an optional decimal place. Acceptable inputs: ...

Customize the month template of the Kendo datepicker calendar popup in an AngularJS application

I've been working on adjusting the month template for an existing calendar popup. Initially, I used the code below: $("#" + attributeId).kendoDatePicker({ dates: jsonResult, weekNumber: true, month: { // template for dates in ...

Exploring Amcharts using detailed JSON data

[{"SUM_PTS":{"datatype":"INTEGER","length":"8","value":"29903727","obfuscated":"false"},"SUM_TOTAL":{"datatype":"INTEGER","length":"10","value":"1644704985","obfuscated":"false"},"MID":{"datatype":"ALPHANUMERIC","length":"27","value":"Vendor 1","obfuscated ...

Issue encountered while deploying MVC web system on Windows Server 2008

I encountered an error when inspecting my MVC 5 websystem in Google Chrome after publishing it. Here is the code that I added to my View: @model abc.def.Models.ClsSECEditors @{ ViewBag.Title = "Index"; } <style type="text/css"> .deleteLi ...

The XMLHttpRequest response states that the preflight request did not meet the access control check requirements

I am attempting to subscribe to a firebase cloud messaging topic by sending an http post request. var data = null; var xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener("readystatechange", function () { if (this.readyState ...

An issue occurred with the session being undefined in Node.js Express4

I'm encountering an issue where my session is undefined in new layers even after setting the value within an "if" statement. /*******************************************/ /**/ var express = require('express'), /**/ cookieParse ...