- MiniCircle
- Text when img hover is switched ...
- Visit https://github.com/locomotivemtl/locomotive-scroll
- copy locomotive-scroll.css
- copy smooth scroll js Smooth Scroll script: const scroll = new LocomotiveScroll({ el: document.querySelector('#main'), smooth: true });
- Put the loco css in a separate file
- Put the js script in script.js
- Link the smooth-scroll JS & CSS in the HTML
- link the CDN of smooth scroll inside <script> tag
- Go to GSAP CDN & link the script to HTML
- HTML
-
CSS .miniCircle{ width: 11px; height: 11px; position: absolute; border-radius: 50%; background-color: white; z-index: 999999; transition: all cubic-bezier(0.19, 1, 0.22, 1) 1s; display: none; }
-
JS const circleMouseFollow = () => { window.addEventListener('mousemove',(details) =>{ // console.log(details.clientX, details.clientY); document.querySelector('#miniCircle').style.transform =
translate(${details.clientX}px, ${details.clientY}px)
document.querySelector('#miniCircle').style.display = 'block'; }) } circleMouseFollow();
- Put every Element inside separate div
- translateY the element, below the div and hide the elements.
- Now Use GSAP in Script.js