Implementing a splash screen upon selecting the second exit option

Check out the code snippet here: https://jsfiddle.net/wust7gdy/

Once the curtain is raised, the exit button will appear.

How can I introduce a splash screen after clicking the 2nd exit button?

Currently, there is a splash screen that appears after clicking the 1st exit button.

I aim to include another splash screen after clicking the 2nd exit button.

Seeking guidance on how to implement this in the code effectively.

The approach involves replicating .splash-screen2.

Struggling to ascertain the process of achieving this functionality.

.splash-screen3 {
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    z-index: -1;
    inset: 0 0 0 0;
    Background-color: green;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="165" height="165" viewBox="0 0 165 165"><rect x="80" y="80" width="10" ...;

html:

<div class="splash-screen3">
  <div class="inner">
    <div class="container2">
      <img src="https://i.imgur.com/z5MMJnv.png" alt="Image 1">
      <div>
        <img src="https://i.imgur.com/5u16syR.png" alt="Image 2">
        <img src="https://i.imgur.com/ygTtvme.png" alt="Image 3">
        <img src="https://i.imgur.com/QziKNDW.png" alt="Image 4">
      </div>
      <img src="https://i.imgur.com/8Jf8LLc.png" alt="Image 5">
    </div>
  </div>
</div>

Functional requirements:

When the first exit button is clicked:

https://i.sstatic.net/C2BP2.png

This view should be displayed:

https://i.sstatic.net/qbjjc.png

The videos are then revealed:

https://i.sstatic.net/IDqhW.png

Scroll down and activate the second exit button:

https://i.sstatic.net/sqeR0.png

You should now see the second splash screen:

https://i.sstatic.net/iC2dM.png

And finally, the subsequent set of videos:

https://i.sstatic.net/Y61UR.png

... (the rest of the code remains the same)

Answer №1

To make the necessary changes in your code, follow these steps:

Start by adding the hide class to the splash-screen3 element:

<div class="splash-screen3 hide">

Next, remove the line pointer-events: none; from the CSS for .splash-screen3:

...
    opacity: 1;
    /* Set transition duration to 1 seconds */
    pointer-events: none; /* REMOVE THIS */
    /*disable mouse clicking */
    cursor: default;
  }
...

Add the selector for splash-screen3:

...
const splashScreen2 = document.querySelector('.splash-screen2');
const splashScreen3 = document.querySelector('.splash-screen3'); // ADD THIS

Include an event listener on splash-screen3 to remove pointer events after the transition ends:

...
splashScreen3.addEventListener('transitionend', function(){
    splashScreen3.style.pointerEvents = 'none';
});
...

Lastly, add these lines at the end of the exitClickHandler function:

...
function exitClickHandler() {
...
  splashScreen3.style.pointerEvents = 'auto';
  splashScreen3.classList.remove('hide');
  splashScreen3.offsetWidth = splashScreen3.offsetWidth;
  splashScreen3.classList.add('hide');
}
...

The first line reenables the pointer-events CSS property, then we remove the hide class to display the splashScreen3, set offsetWidth as a dummy for triggering a reflow, and finally add the hide class again to hide the splashScreen3.

Check out the updated jsfiddle here

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

The <HTML> element is just a bit too big for the screen

When viewing my webpage on mobile, the video background does not fit the screen properly (it fits in landscape orientation). Here is the video tag I am using: <video autoPlay loop muted playsInline className='absolute w-full h- ...

Sorry, but we're unable to provide a unique rewrite of text that is an original error message

Trying to fetch data from a MySQL database using Next.js API routes, I encountered the following error: Error: No response returned from the route handler Below is an example of the code being used: import { NextResponse } from "next/server"; impor ...

Guide on running a MySQL query in an asynchronous function in a Node.js application

Encountering some challenges while using MySQL in a node/express JS application. It seems that when trying to access the MySQL database within an asynchronous function, the code will 'skip over' the SQL query and run synchronously. This is the co ...

Filtering Results Efficiently Based on Various Criteria in React

To view my project in action, please visit my sandbox here. Due to limitations, I am unable to paste all of the code directly here. The goal of my project is to create a tours filtration system based on multiple criteria. Each tour is represented as an ob ...

Collect data from a third-party website that necessitates the activation of JavaScript

Given that phantomjs has been abandoned, I am exploring alternative methods. For instance, using chrome-webdriver may not be ideal as it cannot operate on a remote host like heroku. Is there a way to scrape a website that relies on JavaScript being activa ...

Is there a way to retrieve a collection of files with a particular file extension by utilizing node.js?

The fs package in Node.js provides a variety of methods for listing directories: fs.readdir(path, [callback]) - This asynchronous method reads the contents of a directory. The callback function receives two arguments (err, files), with files being an arra ...

Updating with Ajax is functional for radios and checkboxes, however it does not work for buttons

When a button is clicked, I want the form to process and update accordingly. HTML: <input type="button" value="5.00" name="updatefield" id="updatefield" class="chooseit"> I have also tried: <button name="updatefield" id="updatefield" class="ch ...

Using media queries in CSS to create responsive designs

<link type="text/css" rel="stylesheet" media="only screen and (max-device-width: 480px)" href="/assets/css/phone.css" /> <link type="text/css" rel="stylesheet" media="only screen and (min-device-width: 768px)" href="/assets/css/tablet.css" /&g ...

Using JavaScript to transform radio buttons into checkboxes

I have a grouping of radio buttons and a checkbox displayed on the page as shown below <html> <head> <title>Languages</title> <script type="text/javascript"> </script> </head> <body> <spa ...

Adjust rankings based on the number of upvotes received by a project

I'm facing a challenge with ranking projects based on the number of votes they receive. No matter the vote count, the project always ends up getting ranked as 1. To address this issue, I developed a function to manage the rank count and a return hand ...

Utilize morris.js within an AngularJS directive to handle undefined data

Using the morris.js charts in my angular js app has been a great addition. I decided to convert it into a directive for better organization and functionality: barchart.js: angular.module('app_name').directive('barchart', function () ...

ajax duplicator and reset form tool

Hello everyone, I have a website where users can add their experiences. While adding an experience, they can dynamically add and remove more fields. One of the input fields is for a date, but when the data is submitted, the same date appears for all entrie ...

Preserve the wpColorPicker selection using personalized knockout bindings

Utilizing wpColorPicker and knockout, my goal is to update the color picker value in my observable and then store it in the database as JSON. While other elements successfully update and save, there seems to be an issue with my custom binding for the data ...

Accessing a hyperlink within the existing page

How can I make a hyperlink in an HTML document that opens the linked document (link1.html) under the link on the same page? links.html: <body> <h3>Links</h3< <a href="link1.html">link1</a> </body> Desired out ...

What is the best way to include a new property to an existing interface and then export the updated interface in Typescript?

Can you provide guidance on creating a new interface - UIInterface that combines SummaryInterface with additional properties? For example: import { SummaryInterface } from 'x-api'; // summaryInterface includes 20+ predefined properties generated ...

implementing automatic ajax requests when user scrolls

This is a piece of JavaScript code: $(window).scroll(function() { $.ajax({ type: "GET", url: "not_data.php", data: dataString, success: function my_func () { //show new name ...

Drop-down functionality in Bootstrap Form becomes unresponsive after screen width is decreased

I recently encountered a strange issue with my simple Bootstrap form. When I resize my browser width to mobile size or view it on a mobile device, the form stops functioning properly. Unfortunately, I am unable to provide any specific code examples at this ...

React text hover image functionality

Just diving into the world of React and attempting to create a cool image popup effect when you hover over text in my project. I could really use some guidance on how to make it function within React, as the logic seems a bit different from plain HTML. Any ...

Aligning two divs both horizontally and vertically within two adjacent columns each with a width of 50%

Struggling to align two divs both vertically and horizontally within their respective parent containers that are placed side by side with 50% width and 100% height? Check out my solution on Codepen for reference. View Codepen Example *** HTML *** <di ...

Receiving a commitment from an Angular Resource

When working with $resource in Angular for CRUD operations, I'm encountering some confusion regarding the usage of different resource methods. From what I've observed, the "regular" methods like save() and get() appear to execute synchronously. ...