Attempting to create a dynamic hover effect using GSAP in Next.js 13 while also utilizing TailwindCSS

Currently working on a website using Nextjs 13 (TypeScript), tailwind, and GSAP. I'm curious to know if it's feasible to create an animation similar to the one shown in the enclosed screenshot (please excuse my basic paint skills). https://i.sstatic.net/QCsSl.jpg

This is not a button, but rather a decorative word that will transition to another word with a different style upon hovering over it.

Answer №1

This solution utilizes a grid layout with overflow hidden and translate to achieve a CSS-only approach.

<div class="group m-5 grid h-10 w-20 cursor-pointer grid-cols-2 overflow-hidden rounded-lg border-2 border-orange-400">
  <div class="grid h-10 w-20 -translate-x-full -translate-y-[2px] place-content-center rounded-lg border-2 border-orange-400 bg-orange-400 text-center font-bold text-white transition-transform duration-500 group-hover:translate-x-0"><span>GREAT</span></div>
  <div class="h-10 -translate-x-full -translate-y-[2px] rounded-lg border-orange-400 font-bold text-orange-400 transition-transform duration-500 group-hover:translate-x-full"><span class="block w-20 py-2 text-center">GOOD</span></div>
</div>

https://play.tailwindcss.com/J45fD2mYLA

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

Angular 2: Utilizing Http Subscribe Method with "this" Context Pointer

Question: http.request('js/app/config/config.json').subscribe(data => { this.url = data.json().url; }); It seems that "this" is pointing to Subscriber instead of the parent class. I was under the impression that the fat- ...

What could be causing my Angular2 component to not properly use my template?

I have two components that I am working with. The first component is: import {Component} from 'angular2/angular2'; import {Navbar} from './navbar'; @Component({ selector: 'app' template: `<div class="col-md-12"> ...

Is there a way to import TypeScript modules from node_modules using browserify?

After successfully running tsc, I am facing difficulty understanding how to import TypeScript modules from node modules. The crucial section of my gulp file is as follows: gulp.task('compile-ts', ['clean'], function(){ var sourceTsF ...

What is the equivalent of specifying globalDevDependencies for npm @types packages in typings?

I am looking to update a project using tsc@2 and remove typings from my toolchain. Updating common dependencies is easy as they are listed in my typings.json file: "dependencies": { "bluebird": "registry:npm/bluebird#3.3.4+20160515010139", "lodash": ...

"Utilizing the autocomplete feature in Angular 2 with datalist for

const availableBooks: Array<{ id: number, title: string }> = [{id: 1, title: "book1"}, {id: 2, title: "book2"}, {id: 3, title: "book3"}, {id: 4, title: "book4"}]; <form [formGroup]="bookForm" novalidate (ngSubmit)="save(bookForm)"> <div ...

The 'app' module is missing! Perhaps you mistyped the module name or overlooked loading it

Currently, I am in the process of developing an application using TypeScript along with AngularJS. However, I have encountered the following error: Error: [$injector:nomod] Module 'app' is not available! It seems that either there is a typo in t ...

Unable to assign values using Promises in an Angular component

While working on a Component HTML file, I encountered an issue with exposing a variable. The variable was supposed to retrieve a value from the response using cl.getMonitors. Strangely, despite seeing console.dir(res) in the console, the value of the var ...

Is there an alternative method to access the request body in Nest.js apart from using ParamDecorator?

Is there a better alternative to ParamDecorator for accessing the body or request? Perhaps using a function decorator or something on a global scale? @Post('token') public async createToken(@Body() body: UserLogin): Promise<any> { return ...

Store the HttpRequest value within the component

I am encountering an issue with the Http Request value. I am sending an Http request to an Express API rest, and I want to display the value throughout my component. The data is available in the observable but not in other functions of my component. Can ...

Tips for dynamically displaying Angular Material tags within an Angular component using JSON data

I received a JSON response structured like this: { _id: '5dd0d0dc4db1cf9c77781aaa', picture: 'http://placehold.it/32x32', name: 'Graciela Mcmahon', guid: '98c0fcc2-1dfc-4974-bdae-d8263d783e0a&ap ...

Using TypeScript to consolidate numerous interfaces into a single interface

I am seeking to streamline multiple interfaces into one cohesive interface called Member: interface Person { name?: { firstName?: string; lastName?: string; }; age: number; birthdate?: Date; } interface User { username: string; emai ...

Unresolved (waiting for response) unidentified

I encountered a perplexing error in Chrome and I am unable to identify its source: https://i.sstatic.net/f9Blt.png The only clue I have is that after refactoring approximately 10,000 lines of code, this error surfaced. It occurred during the middle of the ...

Encounter issue with async function in produce using Immer

Having an issue while attempting to create an asynchronous produce with immer. When calling the async function, this error is encountered: Below is my code snippet: import { combineReducers, createStore } from 'redux'; import produce from ' ...

Retrieve the additional navigation information using Angular's `getCurrentNavigation()

I need to pass data along with the route from one component to another and retrieve it in the other component's constructor: Passing data: this.router.navigate(['/coaches/list'], { state: { updateMessage: this.processMessage }, ...

Tips on transforming current JSON into an alternate JSON format

Using React with TypeScript, I have a JSON data set of employees categorized by their department. Here's a snippet of the JSON data: [ { "department": 1, "name": "Test", "age": 32, "contact": 242222120, "id": 1 }, { "department": 1, "name": "Te ...

Can I utilize a script tag within an SVG element in a React application?

I have come across some SVG images that contain scripts within them (specifically for handling the onClick event), like this: <svg xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs ...

React has the ability to disregard rendering outdated components of the UI that were generated programmatically

It's a bit tricky to pinpoint the bug, so let me describe what is going on instead. To simplify things, I have an array named strArr with three strings. Here's how I display them: <p>{strArr[0] + strArr[1]} <span>{strArr[2]}</span ...

NextAuth.js in conjunction with nextjs version 13 presents a unique challenge involving a custom login page redirection loop when using Middleware - specifically a

I am encountering an issue with NextAuth.js in Nextjs version 13 while utilizing a custom login page. Each time I attempt to access /auth/signin, it first redirects to /login, and then loops back to /auth/signin, resulting in a redirection loop. This probl ...

Can Next.js 13 support the usage of axios?

Despite trying to implement the SSG operation with the fetch option {cache: 'force-cache'}, I consistently received the same data even when the mock server's data changed. I found that using the fetch option {cache: 'no-store'} do ...

The npm build error arises when attempting to render a page using Next.js 14 with router params

Dealing with Server Errors in Next.js 14 Build for Email Verification While working on implementing an email verification flow using Next.js 14, I've encountered server errors during the build process. Interestingly, everything runs smoothly in devel ...