Scrolling Effect with Fixed Background Image in FullPage JS

I am trying to use FullPage JS to create a fixed video background with scrolling content. The issue I am facing is that when I set the video to section 1, it shifts to a white background when scrolling. Any assistance would be highly appreciated!

#fullpage {
  background-attachment: fixed;
  background-repeat: no-repeat;
}

<div id="fullpage">
     <video autoplay loop muted id="myVideo">
            <source src="video/empty.mp4" type="video/mp4">
            <source src="video/empty.webm" type="video/webm">
      </video>
</div>





#myVideo{
        position: fixed;
        right: 0;
        bottom: 0;
        top:0;
        right:0;
        width: 100%;
        height: 100%;
        background-size: 100% 100%;
        background-color: black; 
        background-image: /* our video */;
        background-position: center ;
        background-size: cover;
        object-fit: cover; 
        z-index: -1;
        overflow: hidden
}

Answer №1

Why complicate things? Take a look at this straightforward tutorial for creating a video background.

Use this CSS snippet to achieve the desired result.

video {
  margin: 0;
  padding: 0;
}
.content {
  position: relative;
  z-index: 2;
}
.video {
  position: fixed;
  z-index: 1;
}

Here is the corresponding HTML section.

<body>
 <video id="my-video" class="video">
   <source src="media/demo.mp4" type="video/mp4">
   <source src="media/demo.ogv" type="video/ogg">
   <source src="media/demo.webm" type="video/webm">
 </video>
</body>

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

Guide to saving HTML form data into localstorage as a JSON string through JavaScript

What's the best way to retrieve form values for localStorage as a JSON string without using JQuery? I tried using a for loop but I'm having trouble.. any hints would be greatly appreciated (I'm still new at this). Thank you! <input type ...

ApEditingError: The method editAp is not defined in _this.props

I am facing an issue while trying to invoke the function editAp located in the func.js file from Edit1.js. I have provided the code snippets below for better understanding: import firebase from "firebase"; if (!firebase.apps.length) { firebase.initializ ...

Modifying an object property within a state container array in React using Hooks' useState

As a React beginner, I decided to create a simple Todo app. This app allows users to add tasks, delete all tasks, or delete individual tasks. The Todo Form component consists of an input field and two buttons - one for adding a task and the other for dele ...

The significance of passing attributes in Webgl2

I'm currently learning about three.js and working my way through the documentation. I'm struggling to understand the meaning behind the following explanation, could someone provide some assistance? When you manually create the WebGL 2 renderin ...

Do you have any recommendations for a jQuery plugin that can create a sleek horizontal scrolling image gallery?

Recently, I came across the Smooth div scroll plugin developed by Thomas Kahn, and it fits my requirements perfectly. However, I have encountered a bug that seems to be persisting. The issue arises when both mousewheel scroll and touch scroll are enabled s ...

I encountered a 404 error when attempting to execute the "npm publish" command

While attempting to publish a package to the npm registry, an error is encountered after running the command npm publish. npm WARN prepublish-on-install As of npm@5, `prepublish` scripts are deprecated. npm WARN prepublish-on-install Use `prepare` for buil ...

Triangles without their pointed tips

The left arrows next to the carousel blocks are missing their tips. I'm not sure what else needs to be added in the CSS to complete the triangle shape. Here is the live URL: (located next to the large image, specifically in the information carousel) ...

What could be preventing the onclick event from functioning properly in JavaScript?

After creating a basic JavaScript code to practice Event handling, I encountered an issue where the function hello() does not execute when clicking on the "Click" button. What could be causing this problem? html file: <!DOCTYPE html> <html> ...

having trouble with submitting a form using jquery and handling query string

After adding values to the query string on the form page, I encountered an issue where submitting the form using jQuery resulted in not being able to see the query string values anymore. Am I missing something? $('#PasswordResetForm').sub ...

The UI Bootstrap date picker is malfunctioning on a custom page within ng-admin

I'm a beginner in angularjs and ng-admin. Currently, I am working on a project where I need to integrate a custom UI bootstrap date picker but I am facing an issue with the popup not appearing. Below is the code for my custom page: Here is my custom ...

Tips for accessing <Field> values in redux-form version 7.0.0

class CustomForm extends React.Component { constructor(props) { super(props); this.handleClick = this.handleClick.bind(this); } handleClick() { const { Add, noteList } = this.props; Add('this is title value' , 'this is ...

Combining a form and table on a single webpage, I am curious how to utilize the form to update the table effectively using Express and Node.js

Seeking guidance in website development as I face a particular challenge. I aim to create a dynamic search page for a website. The form should allow users to select a location or category, with the same page updating with relevant results. Despite succes ...

Troubleshooting the Issue of Angular Model Not Refreshing in Angular.js

Running into an issue with my directive where the model isn't updating as expected. Here's a snippet of my HTML code: <div class="text-area-container"> <textarea ng-model="chatText" ng-keyup="updateCount(chatText)">< ...

Guide to incorporating animated material icons in vuetify

in Vuetify makes it easy to utilize mainstream material design icons through the use of the v-icon component. An example of this would be: <v-icon>home</v-icon> I am curious if animated material icons are supported and can be integrated in ...

NodeJS instructs open(html) to execute first before any other code is executed

I am evaluating whether nodeJS is a suitable solution for a project I am working on during my internship. To summarize: I need the basicNode.js file to wait until the open('./basic.html') command has completely opened the browser and loaded its c ...

jQuery Accordion not showing up on screen

On my FAQ page, I have integrated a jQuery Accordion with a repeater control nested inside to display various questions and answers. The FAQ page utilizes a master page named LaunchPage.Master. Here is the code for LaunchPage.Master: <html> <he ...

A guide to showcasing tabs as a navigation menu based on media size using AngularJS

Help needed with creating a navigation menu that includes nav-icons on specific media screen sizes. The goal is to display all tabs as a list when clicking on the nav-icon. An attempt was made to implement a navbar, but it interfered with the tab styling. ...

Is there a method to track changes in the DOM made by AngularJS?

I'm currently exploring ways to detect changes in the DOM caused by AngularJS using jQuery. Despite setting up AJAX and history change listeners, I am still unable to successfully capture these alterations. Is there a way to achieve this? ...

Utilize a JavaScript function on an element that is generated dynamically

I am encountering an issue with my autocomplete function. It works perfectly fine for the input field with the id "field10" that is already created. However, when I dynamically generate new input fields, the function does not seem to work on them. I have ...

Guide to linking two input fields using a single datepicker

To achieve the goal of filling two input fields simultaneously, take a look at the following code snippet: <mat-form-field> <input matInput [matDatepicker]="startDate" formControlName="SaleDate" /> ...