"Utilize the hover functionality in React JS to track the mouse movement

I'm currently facing an issue with a design that involves a 6-column grid and text placed in front of it. The requirement is that when I hover over the text, the background of the corresponding grid column should change to an image. While this functionality works well, I am struggling with hovering behind the text, which seems impossible. Is there any solution available for this? Thank you!

const [disappear, setDisappear] = useState([20]);
  return (
    <PageLayout
      className="bg-softBlack"
    >
      <div className="relative h-[480px]">
        <h1
          className="absolute top-32 uppercase bg-transparent text-gray-10 text-[9.028vw] leading-[0.9] tracking-[-0.06em]"
          style={{ zIndex: 1000, mixBlendMode: "difference" }}
        >
          welcome <br />
          to the LAB.
        </h1>
        <div className="w-full h-full absolute left-0 top-0 grid grid-cols-6">
          {array.map((element, index) => (
            <div
              key={index}
              className="bg-black relative"
              onMouseEnter={() => setDisappear((prev) => [...prev, index])}
            >
              {disappear.some((el) => el === index) && (
                <Image src={element} alt="background" layout="fill" />
              )}
            </div>
          ))}
        </div>
      </div>
    </PageLayout>

Currently utilizing next js for this project, thank you.

Answer №1

Not entirely sure I understand your question, but it appears you are working with tailwindcss.

You might want to explore the group feature in the tailwind documentation for more insights.

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

CSS designed for small-screen laptops is also being utilized on iPads running Safari

To specifically target the iPad/Safari browser and accommodate some minor differences in appearance compared to windows/linux browsers, we are implementing the following HTML meta tag and style query: <meta name="viewport" content="width=device-width, ...

The animation feature on the slideshow is dysfunctional

For this Vue component, I attempted to create a slideshow. The process is as follows: 1) Creating an array of all image sources to be included (array: pictures) 2) Initializing a variable(Count) to 0, starting from the beginning. 3) Adding v-bind:src=" ...

How to retrieve the language of an iOS device using React Native

Currently, I am attempting to retrieve the current locale from iOS devices. During the creation of my project and while using expo, I followed this specific guide. I have experimented with the following code: if (Platform.OS === "android") { langR ...

Implement a hover effect on a specific class targeting a nested element using JavaScript

Is there a method to apply a class that modifies rules for a child element using Javascript? I have successfully added it with CSS but am struggling to do the same with Javascript. Removing the class in JS is easy by referencing the classname before the ho ...

Can anyone provide insight into counting associations in sequelize.js?

When attempting to retrieve a poll with options and their corresponding vote counts, an incorrect count is being returned. router.get("/", (req, res) => { Poll.findAll({ where: { subjectId: req.query.subjectId }, include: { model: PollO ...

The collaboration of Node.js and React.js on a single server

Separate ports are used for Node and React, but API requests from the React app can be proxied to the Node URL. I have opted not to implement server-side rendering for React in order to serve the React app. Instead, I build the React app each time there i ...

Adjustable width columns in Flexbox design

I need assistance with creating a responsive three-column grid layout using Flex in CSS. I have achieved a fairly responsive design by following the CSS provided in the fiddle link below. However, I am facing an issue where the second column (the blue one) ...

How can a REST API prompt a user to set a password upon their initial login?

Running into a scenario with my NodeJS REST API and React app. When a user logs in for the first time, I want to direct them to a page in React where they can set a new password before proceeding. How do I go about achieving this? What should the API retur ...

React unit tests experiencing issues with MSW integration

After creating a basic React application, I decided to configure MSW based on the instructions provided in order to set it up for unit tests in both node environment and browser. The main component of the app utilizes a custom hook called useFormSubmission ...

The next script functions are not compatible with the _document.js file in Next.js

I am working on a project in Next.js and I am trying to load two scripts using the next/script module within the _document.js file. However, when I place the Script tags inside the body tag in _document.js, my scripts are not executing as expected. I follo ...

Struggling to implement JSS hover functionality in a project using React, Typescript, and Material UI

I am a newcomer to the world of React/Typescript/Material UI and I am trying to understand how to work with these technologies together. While researching, I came across a similar question related to using hover with Material-UI. However, the syntax was d ...

Displaying icons from an array using Material-UI

Issue at Hand: Currently, I am utilizing react and material-ui to develop my project. To maintain a clean code structure, I am populating menu items from a constant array as shown below: const menuItems = [ { label: "Home", path: "/home& ...

Static CSS box positioned above dynamic scaling box

Let's Think About It <div id="foo"> Lorem ipsum </div> <div id="bar"> sit amet </div> Is there a way to maintain the size of foo as it is while allowing bar to fill the remaining space on the page when the window size cha ...

Embedding external dependencies into a Node module at the application level

I am currently facing a challenge in creating packages from higher-order components within my application. The issue arises when some of these components use application routes, accessed through a helper that imports all the routes and returns URLs based ...

How come the values in my object remain inaccessible even after assigning values to it with navigator.geolocation.getCurrentPosition() and returning it?

After successfully assigning values to my pos object within the whereAmI function using navigator.geolocation.getCurrentPosition(), I can confirm that lat and lng are present inside the object. However, attempting to access these properties later on resu ...

What is the best way to keep the navbar contained within the parent div (hero image) no matter the size of the screen?

After working on adjusting my website layout for different screen sizes, I encountered an issue with the navbar overflowing the parent image when viewed on my laptop. Despite trying both relative and absolute positioning for the .navbar element and setting ...

I am interested in incorporating RTL in some of my components, but not all of them

In my Nextjs project, I am looking to implement RTL (right-to-left) for certain components. These components are using material-ui. However, changing the direction in _documents.js with <HTML dir="rtl"> results in all components switching d ...

Utilizing Selenium to extract data from a table and displaying the results

I am looking to scrape tables from a specific website, but I am new to automation with Selenium. Here is the code snippet that I have come up with after doing some research: from selenium.webdriver import Firefox from selenium.webdriver.common.by import By ...

"Exploring the process of creating and launching an application on Firebase with the help of Nx and NextJs

After utilizing @nx/next to develop my app, I ended up with a nextJs 13 application incorporating app routing in conjunction with nx. Following the standard Nx repository setup, I worked within the apps/projectName/app directory and created various libs/l ...

Retrieving information from an array and displaying it dynamically in Next.js

I've been diving into the Next.js framework lately and I've hit a roadblock when it comes to working with dynamic routes and fetching data from an array. Despite following the basics of Next.js, I'm still stuck. What am I looking for? I ne ...