What are the steps to create a white or transparent video background and alter the header color?

Quietly admitting, my JS skills are not very strong. I noticed that when we scroll the mouse for the first time, the video brightens (opacity?) and the header text changes from white to black. Can you demonstrate how to achieve this effect? I would like to see a live example to help me understand.

Example provided below:

https://mindbox.ru/

Thank you in advance.

I have outlined my requirements already.

Answer №1

Unfortunately, the link provided is not functional, making it difficult to provide a direct solution without access to the actual code. However, I can offer guidance on creating a hover animation effect. It's essential to review the comments within the CSS code to understand the implementation.

.wrapper {
  width: 100%;
  height: 100vh;
  background: pink;
  display: flex; 
  justify-content: space-around;
  align-items: center; 
  }
  
  .child {
  padding: 15vh;
  background: skyblue;  
  color: red;  
  transition: 0.5s;  
  }
  
  .child:hover {  
    background: white;  
    color: blue; 
    }
<div class="wrapper">
<div class="child">
Hello World!
</div>
</div>

If a specific trigger like scrolling to a certain point is desired for the animation, it can be achieved using more advanced CSS or with the assistance of jQuery or JavaScript.

$(document).scroll(function() {
    var topOfWindow = $(window).scrollTop();
    var bottomOfWindow = topOfWindow + $(window).height();
    var topOfChange = $('.child').offset().top;
    var bottomOfChange = topOfChange + $('.child').height();

    if ((bottomOfChange <= topOfWindow) || (topOfChange >= bottomOfWindow)) {
        $('.myClass').css('background-color', 'red');
    } else if ((bottomOfChange <= bottomOfWindow) && (topOfChange >= topOfWindow)) {
        $('.myClass').css('background-color', 'green');
    }
})
.wrapper {
  width: 100%;
  background: pink;
  display: flex;
  justify-content: space-around;
  align-items: center; 
  }
  
  .child {
    margin: 120vh 0;
  padding: 30vh 40vh;
  background: skyblue;
  }
  
  .myClass {
    background-color: red;
    padding: 5vh;
    transition: 2s; 
  }
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
Scroll down...
<div class="wrapper">
<div class="child">
<div class="myClass">Hello World</div>
</div>
</div>

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

I'm puzzled by the "Uncaught TypeError:" error message and can't seem to figure it out

I'm having trouble displaying the value of 'true' within my objects and keep encountering an error message. Uncaught TypeError: Cannot set property 'toDoIsRemoved' of undefined at removeTask (main.js:85) at HTMLButtonElemen ...

Tips for applying horizontal padding to the container-fluid class in Bootstrap 5

I'm struggling with the CSS code I wrote: .container-fluid{padding 3% 15%;} It's only adjusting the vertical padding to 3%, and there's no change in horizontal padding. #title { background-color: #ff4c68; } .container-fluid { pad ...

How can I adjust the font size in a TextField when it is in focus?

As a novice in ReactJS, I am currently utilizing materia-ui to design a page. I am looking to make a custom change on a TextField where the font size adjusts when text is entered. However, adjusting the font size creates too much space between the label a ...

What impact will splitting a single file into multiple files have on the overall performance of the website?

Imagine having an index.php file that includes multiple other files: Contents of index.php --------------------------- include('header.php'); include('footer.php'); --------------------------- Contents of header.php ------------------ ...

Retrieve all hyperlinks within a table using Beautiful Soup

<td style="text-align: center;"><a title="Some unique title" href="https://www.uniquewebsite.com">Unique Testing Content</a></td> I am attempting to accomplish the task of using BeautifulSoup to retrieve all the href links within a ...

Managing the automatic download of a zip file through JQuery - A guide

When working with a REST API and creating a zip file for forced download, the task is to call the API by sending necessary POST data through JQuery to initiate the download. How can this goal be accomplished effectively? ...

Web application for muting and kicking users in a channel using ARI

I am currently facing a situation where two functions are triggered automatically when I add a call to a bridge. To manage this, I am trying to utilize JQuery so that these functions only execute when a specific button is clicked. This will allow me to pro ...

Unable to modify images and nicknames that have been selected from the steamapi

Having trouble syncing images and nicknames? Try using this: https://www.npmjs.com/package/steamapi New to promises and stuck at a point in your code? Here is the snippet of your code: const SteamAPI = require('steamapi'); const steam = n ...

Utilizing the Flex property on the parent div ensures that all child elements receive an equal width

I am currently working on a messaging application and I want the layout to be similar to Twitter or Whatsapp. Specifically, I want the messages from the person the user is chatting with to appear on the left side, while the user's own messages should ...

Looking for tips on managing hefty Javascript files

Managing my application's 2000 lines of javascript code can be challenging, especially with all the user interaction and jQuery elements. Fortunately, everything is functioning as it should :) To make things more organized, I decided to split the cod ...

What is preventing this setTimeout from triggering?

My experience with Knockout js has left me puzzled, as I seem to be missing a key concept. Despite no error messages, it's challenging for me to pinpoint where exactly the issue lies. All I want is to periodically fetch data and update my table using ...

What could be the reason for parent props not updating in child components in VueJS?

Hello, I am new to VueJS and encountering an issue. In the main.js file, I am passing the user variable to App.vue using props. Initially, its value is {} The getLoginStatus() method in main.js monitors the firebase authentication status, and when a user ...

The React Native app mysteriously crashes repeatedly without generating any error logs when using the same component multiple

Currently, I am developing in React Native app Version 0.70. Encountering a peculiar issue where the React Native app crashes without any error logs in the console. Below is the snippet of my code where most crashes seem to happen: import { ...

Tips for transforming a 9-digit uploaded data into a 10-digit number using Angular

As someone who is new to Angular, I am working with an Angular UI where users upload a CSV file containing 6 columns of data. Before invoking the .NET API, I need to modify the data in the 1st column: if a value consists of 9 digits, it should be changed t ...

Design an HTML button/label with text and a starting width of zero

I'm attempting to design HTML buttons and labels with text that initially have zero width. Once inserted, they should smoothly transition to a visible state. I've tried adjusting the initial width and min-width style properties without success. ...

Exploring the power of ES6: Breaking down an array filled with objects

So I have this object: const settings = { js: { files: [ { src: './js/app.js', name: 'script.js', dest: 'public_html/js/' }, { ...

Error occurs in console when using .getJSON with undefined JSON, but does not happen when using embedded data

Can someone help me understand why I'm getting an 'undefined' response when I use console.log(tooltipValues), but there's no issue with console.log(tooltipJSON). I've noticed that when I embed the data directly in my JS code, ever ...

Accordion nested within another accordion

I am facing a challenge while trying to nest an accordion within another accordion. The issue is that the nested accordion only expands as much as the first accordion, requiring additional space to display its content properly. Any assistance with resolvin ...

Does JSX have an API that can handle self-closing tags, such as <br>, if they are not closed properly?

For my latest project, I've been working on a ReactJS component using JSX and it looks something like this: <script type="text/jsx"> var HelloWorld = React.createClass({ render: function() { return ( < ...

How can I replicate the functionality of a div mimicking a select element using javascript upon clicking away from the element?

My task was to design a pseudo-select element that showcases columns for each row within the select. Due to HTML's restriction on allowing the <option> tag to include HTML, I had to find an alternate solution. One issue I encountered was replic ...