Lava Lamp Style Menu using GSAP - Hover Events
How do I make an lava lamp style menu using gsap - hover events?
Regarding GreenSock Forum Post: http://forums.greensock.com/topic/9030-menu-line-movement/. What is a lava lamp style menu using gsap - hover events? How do you make a lava lamp style menu using gsap - hover events? This script and codes were developed by Jonathan Marzullo on 11 August 2022, Thursday.
Lava Lamp Style Menu using GSAP - Hover Events - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Lava Lamp Style Menu using GSAP - Hover Events</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <h2 style="margin-left:15px;">Lava Lamp Style Menu using GSAP - Hover Events</h2>
<p style="margin-left:16px;">hover over a menu item to see the animated underline:</p>
<div id="box">
<ul id="menu"> <li><a href="javascript:;" class="active">menu</a></li> <li><a href="javascript:;">long menu</a></li> <li><a href="javascript:;">even longer menu</a></li> <li><a href="javascript:;">short menu</a></li>
</ul>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/gsap/1.19.0/TweenMax.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Lava Lamp Style Menu using GSAP - Hover Events - Script Codes CSS Codes
body { color:#555; margin:20px 0 0 10px;
}
#box { position:relative; height:40px; margin:0 0 0 0;
}
ul{ margin:0; padding:0; display:block;
}
li { float:left; margin:0; list-style-type:none; padding:0; padding:5px 20px;
}
li a { display:block; text-decoration:none; font-weight:bold; font-family:Arial; color:#222;
}
li a.active { color:#CC0000;
}
#menu li.slide-line { display: block; padding:0; margin:0; background: none #CC0000; position: absolute; top: 0; width: 43px; height: 6px; left: 0; top: 0; z-index: 0;
}
Lava Lamp Style Menu using GSAP - Hover Events - Script Codes JS Codes
// adds sliding underline HTML
jQuery('#menu').append('<li class="slide-line"></li>');
// set initial position of slide line
TweenMax.set('#menu .slide-line', { css:{width: 43, x: 20, y: 30}
});
// animate slide-line on click
jQuery(document).on('mouseenter', '#menu li a', function () { var $this = jQuery(this), offset = $this.offset(), //find the offset of the wrapping div offsetBody = jQuery('#box').offset(); // GSAP animate to clicked menu item TweenMax.to('#menu .slide-line', 0.7, { css:{ width: $this.outerWidth()+'px', x: (offset.left-offsetBody.left)+'px' }, overwrite:"all", ease: Back.easeOut.config(1.7) });
}).on('mouseleave', '#menu li', function () { var $this = jQuery(this), $active = $this.parent().find("a.active"), offset = $active.offset(), //find the offset of the wrapping div offsetBody = jQuery('#box').offset(); // GSAP animate to clicked menu item TweenMax.to('#menu .slide-line', 0.7, { css:{ width: $active.outerWidth()+'px', x: (offset.left-offsetBody.left)+'px' }, overwrite:"all", ease:Power4.easeInOut });
});
Developer | Jonathan Marzullo |
Username | jonathan |
Uploaded | August 11, 2022 |
Rating | 3 |
Size | 2,490 Kb |
Views | 60,720 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
3D Cubes | 6,201 Kb |
Cross Browser Animating a Radial Gradient Tween - GSAP ColorPropsPlugin | 2,627 Kb |
CSS Opacity using autoAlpha - GSAP | 2,045 Kb |
GSAP and HTML5 Canvas | 2,120 Kb |
Zoom in an image and show a div on hover | 1,876 Kb |
Typing Effect using CSS3 Animation | 1,598 Kb |
CSS Filter Test - Grayscale | 2,250 Kb |
Basic GSAP Image Slider Test | 3,171 Kb |
CSS background-size - GSAP | 2,209 Kb |
GSAP Animate CSS background-position | 2,427 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Personal Website Redesign v2.0 | DevItWithDavid | 5,168 Kb |
CSS Chat Bubbles | Boylett | 2,094 Kb |
A Pen by Alexandru Pora | Axpro | 1,615 Kb |
The Monty Hall Problem | Melatonind | 4,360 Kb |
CSS3 Form Page Design | Rssatnam | 3,613 Kb |
LBCA - Mail canvas | Emnbdx | 3,856 Kb |
Colorful Sliders | Chanrith | 1,246 Kb |
A Pen by Shidhin | Shidhincr | 5,015 Kb |
Custom checkbox example | Capelo | 3,495 Kb |
Sketchy Box | Mnicpt | 3,033 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!