Magnetic Buttons On Mousemove - Using HTML, CSS & Javascript
HTML-код
- Опубликовано: 8 мар 2021
- In this video, you will learn how to design buttons with magnetic hover effect on mousemove using HTML, CSS, and Vanilla Javascript.
+ Like and Subscribe 🔔 for More! 🖤
∎ Get This Project Source Codes - / magnetic-buttons-on-mo...
Book Me 🔖
-----------------------
∎ Book me to Fix your project Bugs & Issues - www.buymeacoffee.com/codingsn...
∎ Book me to Convert your Figma, PSD, and XD Design to an HTML Website - www.buymeacoffee.com/codingsn...
∎ Source Codes & Download Images - codingsnow.com
∎ Download Source Files On Patreon - / 48487539
∎ Facebook Page - / codingsnow
∎ Support From Paypal - paypal.me/codingsnowget
Support My Works ❤️❄️
--------------------------------------------
∎ Buymeacoffee - www.buymeacoffee.com/codingsnow
∎ Patreon - / codingsnow
#MagneticButtons #ButtonsMagneticEffect
____________________
Copyright Disclaimer under section 107 of the Copyright Act of 1976, allowance is made for “fair use” for purposes such as criticism, comment, news reporting, teaching, scholarship, education, and research. Fair use is a use permitted by copyright statute that might otherwise be infringing.
Amazing video mehn...I love it
Very simple, clean and well done!
Thank you very much!
@@CodingSnow codepen.io/cory-al-loxton/pen/ZEBVpEK My codepen that I added some of the magnetic button effect :)
Great video John Snow! Thank you and Love the background music its peaceful and melodious
You are so clever. Actually, the channel name was created based on that name. You're most welcome my friend! ❤
@@CodingSnow Cheers! I loved the "John Snow" Character lol so yeppers.
Btw FYI, I started learning React about 2 weeks ago and wanted to build a portfolio for my freelancing then I realized I must learn more to get all the stuff working and the old site I had made was lame. So I used the dev portfolio site you posted, I'm using that. It's simple and to the point not like those ready-made templates with thousands of lines of code. I'm a bit struggling to align those cards in the "Services" section, I wanted 3 cards in a row but it's not letting me I got 6 cards in total not sure where I'm going wrong.
Btw whereabouts you from buddy?
Cheers GOT fans!!
To align cards row-wise, you need to do some simple changes to the service section and its styles friend.
Replace service section HTML code like below,
My Services
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Web Design
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Web Development
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Motion Graphic Design
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Web Design
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Web Development
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Motion Graphic Design
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
And add the below selector to the styles.
.services .service-row{
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
width: 100%;
}
Study it, you'll understand.
@@CodingSnow Thank you so much! Appreciate the quick response ♥
Wow...😍😍😍..Amazing and amazing..Always love your works bro..I am a big fan of yours.
Thank you very much! 😊
Nice video man
Thank you friend! ❤
Amazing! But is it possible ANTImagnetic effect?
Amazing Video Bro
Thank you bro! ❤
@@CodingSnow You're welcome Brother
how you have created your channel intro , it is so cool
Nice!!
Thanks friend! ❤️
Congrats ! but U should add window.scrollY so that it works in any situation (long page)
Hi, thanks for your help, but on don't founs where we need yo put this command, can you say more ? Please
@@cheart95 card2.forEach(element => {
element.addEventListener('mousemove', function(e) {
const position = element.getBoundingClientRect();
const x = e.pageX - position.left - position.width / 2;
const y = (e.pageY - position.top - position.height / 2) - window.scrollY;
element.style.transform = "translate(" + x * 0.3 + "px, " + y * 0.3 + "px)";
})
});
THANK YOU. I was very confused as to why it wasn't working, in my case it was always translating my div down even when entering from above. Turns out I had to subtract the window offset as you suggested here.
For those wondering, here's the code that worked for me:
const position = event.target.getBoundingClientRect();
const x = event.pageX - window.scrollX - position.left - position.width / 2;
const y = event.pageY - window.scrollY - position .top - position.height / 2;
@@JomaSnow i had no idea how to implement this thank youuuu
good ... ocay ...
& news box design record plz
How to make Jarvis pls sir
how you have created your channel intro , it is so cool
Thanks!, with Aftereffects