Hero image with CSS animation type that blocks or is blocking, enhanced with a JavaScript effect

Hello fellow UX Designer who is learning to code! Please excuse any mistakes in my code.

I have a CSS animated text overlay on top of a Hero Image with a JS effect applied to it.

Initially, I had trouble getting both images to display correctly. Either the text would show but hide the hero image behind it, or the hero image would appear but cover the text.

At first, I thought the issue was related to a class that was making the background of the text opaque, but after some troubleshooting by selectively commenting out parts of the code, I ruled that out.

Then, I realized that placing the text div inside the Hero Image div solved the problem. However, this only worked because I had disabled the Javascript effect applied to the Hero Image.

It seems like the tilt-effect class from the JavaScript script might be causing the conflict. Unfortunately, my knowledge of JavaScript is limited, so I'm not sure what specifically is causing the problem.

I suspect it has something to do with how the JavaScript is manipulating elements on the page. I've encountered a similar issue in the past when working with a footer and a responsive image gallery controlled by JavaScript, where the layout would shift after the gallery loaded. Could this be a similar case here?

If you'd like to take a look at the code, you can find it on JSFiddle: http://jsfiddle.net/thedonquixotic/8vv7t1as/2/

The part of the JavaScript responsible for the Tilt FX effect is labeled as the second section in the code.

Below is an excerpt from the HTML:

<!--Hero image with tilt effect-->

<div class="hero">

        <div class="hero__imgwrap">
            <!--<div class="grid__item">
    <a class="link link--kumya" href="About.html"><span data-letters="David French">David French</span></a>
            </div>-->
            <img class="hero__img tilt-effect" data-tilt-options='{ "opacity" : 0.3, "extraImgs" : 3, "movement": { "perspective" : 1700, "translateX" : -7, "translateY" : -7, "rotateX" : -7, "rotateY" : -7 } }' src="https://cdn.tutsplus.com/craft/uploads/2013/11/14-snowflakes-lay-paper-copy.jpg" alt="Welcome!" />
        </div>
</div>
<!--Hero image with tilt effect-->

And here is the relevant section of the JavaScript:

(JavaScript code provided)

Answer №1

I've made some adjustments to the CSS in order to better understand it:

    .grid__item {
        position: absolute;
        left: 50%;
        z-index: 1;
        display: flex;
        justify-content: center;
        top: 50%;
    }


    .link--kumya {
        font-family: "Syncopate",sans-serif;
        font-size: 6.5em;
        overflow: hidden;
        color: #242424;
        position: relative;
        left: -50%;
        top: -70px;
        text-align: center;
    }

By making these changes, you'll notice a new type and an animated background will appear.

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

Align the date input field to the center for better visual appeal

I am facing a challenge in centering the date in an input, not the entire input element inside a div. When I attempt to center it, the date gets positioned within a portion of the input due to a resizable right-hand side panel for selecting a date from a c ...

Tips for including a decimal point in an angular reactive form control when the initial value is 1 or higher

I am trying to input a decimal number with 1 and one zero like 1.0 <input type="number" formControlName="global_velocity_weight" /> this.form = this.fb.group({ global_velocity_weight: new FormControl(1.0, { validators: [Valida ...

"Learn how to seamlessly submit a form and display the results without the need to refresh the

Here is the form and result div: <form action="result.php"> <input type="checkbox" name="number[]" value="11" /> <input type="checkbox" name="number[]" value="12" /> <input type="checkbox" name="number[]" value="13" /> <input t ...

Tips for storing an image from an HTML file input element into a specific folder

One of the elements on my webpage is as follows: <input type="file" accept="image/*" id="fileAdd" name="image" size="30" /> I'm looking for a way to store the image selected by the user into a specific folder within the project. How can I ach ...

Display a loading screen to the user while Vue lazy loads the content

I am currently implementing lazy loading features for my single-page application using Vue.js and Laravel Mix 5. I am looking for a way to display a loading page to prevent the app from appearing unresponsive while new pages are loading. I attempted to ad ...

Should the secret for express-session be a fixed value or should it change dynamically?

I'm uncertain whether the secret for this application should remain static or if it can be dynamic. Currently, I am setting the secret as follows: var salt1 = bcrypt.genSaltSync(); var salt2 = bcrypt.genSaltSync(); var secret = bcrypt.hashSync(salt1 ...

Illuminating JavaScript code with the help of ngx-prism

Looking to enhance the readability of code on my website, I decided to incorporate syntax highlighting. After some research, I came across ngx-prism. Following the steps outlined in its documentation: I executed the following commands: npm i --save @n ...

Issues are occurring with the @font-face css for the Futura Bk BT Bok.ttf font file

Is there a way to incorporate the 'Futura Bk BT Bok.ttf' font into my website using the CSS @font-face rule? Here is a snippet of my current CSS: @font-face { font-family: abcd; src:url('Futura Bk BT Bok.ttf') format('true ...

Steps to incorporate iframe into a webpage with 100% height and enable page scrollbars

Looking to seamlessly integrate an iframe into a webpage? Here are the requirements: The iframe height must adjust to fit its content, occupying 100% of available space. Hide scrollbars within the iframe, allowing the page's scrollbars to adjust acc ...

The mysterious ASP.net Ajax method that eludes discovery

Having experience with numerous ajax calls in the past, I have encountered an issue with this particular one =( I'm seeking advice on what changes need to be made to get this specific ajax call to work. In my previous attempts, I faced an internal s ...

Running LAMP and Node.js concurrently on a single server

Currently, I have a PHP application built on the Laravel Framework and a separate node.js application. The node.js app is responsible for sending push notifications to user browsers using socket.io due to PHP's limitations with long polling processes. ...

Creating a React component in Typescript to utilize lodash helper functions

I have a component that looks like this: import React, { Component } from 'react'; import throttle from 'lodash.throttle'; interface Props { withScroll: boolean; } class Image extends Component<Props, {}> { throttledWindowS ...

Angular - automated pagination functionality without requiring user input

I apologize for the poorly worded title. Context In my static display angular app, I am not incorporating any user interactions and most actions are time-based. The page loads, and after a specific amount of time determined by certain elements, it reload ...

Issue: $injector:unpr Unrecognized Provider DataServiceProvider (a provider that has not been defined before)

Encountering this issue: Error: [$injector:unpr] http://errors.angularjs.org/1.5.6/$injector/unpr?p0=DataServiceProvider%20%3C-%20DataService%20%3C-%20SignupController Suspecting that the problem lies in the fact that DataService cannot be found due to ...

changing the name of a variable within ng-include

Here is some important HTML code: <ng-include src="'app/views/order.html'"></ng-include> Within the scope of this ng-include, there is a variable called trade. The structure of the trade variable is as follows: var trade = { or ...

Attempting to update the state by utilizing the values provided by useContext

Hey there! I'm currently working on a Gatsby React app and my main objective on this particular page is to remove some localStorage and reset context AFTER rendering. The timing of this reset is crucial because I need the page to initially render with ...

Tips for setting up a proxy with an enum

I am facing an issue with setting up a Proxy for an enum. Specifically, I have an enum where I want to assign a value to this.status using a Proxy. However, despite my expectations, the output "I have been set" does not appear in the console. Can anyone ex ...

What is causing the error in this particular stream function?

I created a function that logs the provided arguments to the console when piped into it. function logToConsole() { var stream = new Stream.Transform({objectMode: true}), args = [].slice.call(arguments); stream._transform = function (data, ...

Learn how to dynamically incorporate multiple Bootstrap collapse elements in PHP

I've encountered an issue with my code that contains both HTML and PHP. The problem arises when there are multiple elements in a collapse, as only the first element works properly. This is due to the fact that each element has the same id named "colla ...

"Troubleshooting: Why is my AngularJS ng-click not triggering the function

My custom directive fetches a navigation block from a webservice call. I am attempting to click on a navigation link that has an "ng-click" attribute set, which should call the specified function. However, the function is not being executed. Below is my r ...