Тёмный

Creating Custom Cursors - CSS Only, and JavaScript! 

DesignCourse
Подписаться 1,1 млн
Просмотров 205 тыс.
50% 1

Опубликовано:

 

4 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 246   
@bruneltommy5145
@bruneltommy5145 5 лет назад
For scrolling page css: transform: translate(-50%, -50%);position: fixed; js: cursor.setAttribute("style","top: "+(e.pageY - scrollY)+"px; left: "+(e.pageX)+"px")
@KriszX12
@KriszX12 4 года назад
Pure luck we have you here. I just randomly checked comments a while after I put back my cursor project from my portfolio site since cursor leaves the hooked div while scrolling, then updated again when the cursor is moved. Caused div element to jump to the cursor after scroll. :/ So thanks :D
@Chill_Sammi
@Chill_Sammi 3 года назад
You're a legend for this man
@sunkarasridhar3885
@sunkarasridhar3885 3 года назад
Css transform translate is being ignored after adding the animation. Is there a way to keep the div centered to the mouse?
@nicolasd09
@nicolasd09 3 года назад
@@sunkarasridhar3885 You need to substract half the height and half the width to your attribute (e.pageY - scrollY - Z), Z being half the height of your cursor
@katetretyakova4901
@katetretyakova4901 2 года назад
@@KriszX12 thanx a lot , man!
@matther2012
@matther2012 5 лет назад
Hey Gary, great video. I really liked the animations there. One thing worth mentioning is that your implementation doesn't look like it takes into consideration that the cursor is always in the way of what you would be trying to click on like a link or something. Setting "pointer-events" to "none" on .cursor allows the cursor to be clicked through and would fix that issue.
@DesignCourse
@DesignCourse 5 лет назад
Yep, realized that when I put the codepen up!
@dhawalm
@dhawalm 5 лет назад
You just saved a life!
@LabhamJain
@LabhamJain 4 года назад
@@DesignCourse Pin This Comment Gary! 😁😁😁
@kenethaguilarnajera6489
@kenethaguilarnajera6489 3 года назад
I love
@monotonia3541
@monotonia3541 3 года назад
Nice solution, but there's another issue, when it hover a link the "hand" cursor shows up, at least on my page, there's a way to fix this?
@premkumarh
@premkumarh 5 лет назад
It's midnight in India and I was prototyping my portfolio. Seems like I need to add this too I ain't gonna over do my website but I'm gonna add it for sure.. Loved it♥️
@testchannel7062
@testchannel7062 3 года назад
whats your portfolio i wanna look at it, maybe get inspired too :)
@AshishKumar-zi9gy
@AshishKumar-zi9gy 5 лет назад
really needed this one, was trying to figure it our with jquery coz i am handy with that.... love this one
@kcblackbyrn5896
@kcblackbyrn5896 3 года назад
Thank you for this tutorial. I feel like I learned something because you were saying what you were doing and giving clear instructions. I'm not a fan of just copying directions with those silent tutorials so it was a relief to find your video. Thanks!
@nparashar150
@nparashar150 3 года назад
Yess why not ? It looks so cool like you can see the idea of custom cursor adapted by some Devs in so cool way
@juujuu1658
@juujuu1658 4 года назад
Cool. Just fyi, did not finish watching but have checked the codepen and I think it could be better. 1. change cursor position: absolute -> fixed 2. replace pageX / pageY with clientX / client Y Then it will act as a real cursor without moving during scrolling.
@juujuu1658
@juujuu1658 4 года назад
@Rohan Kavathekar happy to help! : )
@revoiden
@revoiden Год назад
thank you so much
@pankajjaiswal1778
@pankajjaiswal1778 4 года назад
I saw many custom cursor tutorials yet end my search at your channel again.
@LHM1226
@LHM1226 Год назад
Bro look so much like the protagonist of fight club. No wonder why you could produce such great content!
@babybabloo8119
@babybabloo8119 2 года назад
Vừa vào đã nổi cả da gà 藍giọng a Phúc hayyy quá, mong sẽ tiếp tục cover ạ ❤️
@hongcai4617
@hongcai4617 4 года назад
very useful! I used it to create a photo frame design. I like your efficient code, no one line wasted
@millankumardas6593
@millankumardas6593 3 года назад
Such a great content especially for beginners. Thank you for this. Just keep these things up man. Fantastic job.
@mshimanshu1000
@mshimanshu1000 3 года назад
You deserve more than a million likes man !!!!
@volodymyrberezovskyi6293
@volodymyrberezovskyi6293 5 лет назад
Thank you! Especially for mentioning pointer-events: none;
@gauravborra1
@gauravborra1 5 лет назад
Hi Gary, whenever i am searching how to video,next day you magically make video of that. Can you make video on preloading and prefetch contents of a website ?? Anyways you are posting awesome stuff that i once think and say "how to do that" and now i am doing that. Thanks a TON for your videos
@razenkellesly20
@razenkellesly20 5 лет назад
Man YOU ARE SUPER HERO bring more creative tutorials , what about line animation ?
@6191jaken
@6191jaken 5 лет назад
I loved the tutorial. Has far as the question of customizing the cursor, my answer is that it depends on what you are doing. For instance, I may be developing a site for musicians. I can make the cursor into a note. Or, if I am working on a patriotic type of site, I can turn it into a flag. I see endless possibilities.
@kenyk1254
@kenyk1254 Год назад
Thank you, great tutorial, exactly what I was after!
@asaboor
@asaboor 2 года назад
Very neat and scalable solution
@DesignCourse
@DesignCourse 5 лет назад
Enjoy? Sub up! My answer for today's question: I think as long as it's kept *minimal*, and ideally still keeps the original cursor pointer around, it can work. It all depends on the context/purpose. You?
@Fliteska
@Fliteska 5 лет назад
I'd say no to custom cursors, being from the times of downloadable cursors it just brings back bad memories. I think the only time it would be good is a browser game like an old style rpg
@BrianSamThomas
@BrianSamThomas 5 лет назад
I say yes to customizing cursor! But it all does depend on the context. I'd want to (probably just for a personal project), maybe create a better svg of the original cursor (designed *for* the context) . And then give it some subtle transitions with minimal animations. Especially on something like all navigation elements. This would be to completely replace the original cursor, ofcourse. I mean, the more I think about it, the more the possibilities. Thank you for this introduction. #SweeetIndeed 17:48 🙌🏼
@ladyshh
@ladyshh 5 лет назад
I'd say it depends. If the site is for a designer/photographer/creative blog then the answer is yes (minimal as you say) otherwise the answer is no.
@onnokichu5381
@onnokichu5381 3 года назад
This video has been helpful for me. Thank you so much.
@zsuzsannahorvath1010
@zsuzsannahorvath1010 8 месяцев назад
It's very very good and useful. Thanks for the informations.😃
@arthurprather6720
@arthurprather6720 5 лет назад
Customizing the cursor, yes or no? For personal websites or portfolio sure why not. But for business, e-commerce, or professional websites, bad idea!
@christianachleitner9439
@christianachleitner9439 5 лет назад
why so?
@arthurprather6720
@arthurprather6720 5 лет назад
@@christianachleitner9439 Every pages have purpose or expectation for visitors. The goal for developers is to build a site that will get visitor to comeback and visit site again or refer other visitors to visit that site in the future so site can grow. If developer fail to meet expectation, then the site would become useless. For example, over animated page that require loading time, would turn off for most visitors who want to seek for quick information. I would recommend read good books - "Don't make me think" and "Design Everyday things". This will put better perceptive for most front-end designers/developers.
@RivenbladeS
@RivenbladeS 4 года назад
@Hoyt Volker Well, in my opinion, if it perfectly fits the aesthetic of the website, it is professional and it gives a unique experience/feeling, it is very good and worth it.
@FirdavsiWebDev
@FirdavsiWebDev 4 года назад
@@arthurprather6720 That was great explanation and thanks for recommending the books
@ThePixelitomedia
@ThePixelitomedia 4 года назад
@@arthurprather6720 thats bs. Especially in advertising and design websites its a unique look and ux important...
@Rehan09able
@Rehan09able 4 года назад
thanx for tutorial gary, u r always helpful for me.
@حيدرنوريطالب
@حيدرنوريطالب 3 года назад
Thanks Very Mach For This Video
@human_error1
@human_error1 3 года назад
To centre the custom cursor to the default browser mouse you can get the absolute center by simply adding "transform: translate(-50%, -50%);" to the custom cursor css without doing any maths in the JS 👍
@jaydobariya8
@jaydobariya8 2 года назад
yes bacause of this cursor are very good for UX thats why this is amezing .....
@beegoodb1213
@beegoodb1213 7 месяцев назад
Thank you this is insightful
@chethanjm2685
@chethanjm2685 2 года назад
Chỉ cần Đức Phúc hát ballad thì dù buồn hay vui ĐP cũng truyền tải cảm xúc của bài hát rất tốt. Bài buồn thì nghe đúng kiểu tự sự, đau khổ, nghe là muốn khóc. Còn bài vui thì lại nhẹ nhàng, ấm áp, chân thành nghe là muốn yêu❤️
@abhijithchandran5744
@abhijithchandran5744 5 лет назад
Hi bro, can you make video about three. Js. And thanks for this amazing video
@valix85
@valix85 5 лет назад
Very cool, yes customize it all!
@jaxxbird7
@jaxxbird7 4 года назад
Such a good Tutorial! Thank you so much!
@azizbeksamatov4631
@azizbeksamatov4631 3 года назад
Yes. Because it's beautiful.
@fabiobaziota5919
@fabiobaziota5919 3 года назад
I love yout tutorial u are my inspiration thank u so much from Angola/Luanda....
@ainjohan4161
@ainjohan4161 3 года назад
i feel like his voice is similar to the rat character Remy in Ratatouille Disney movie. Its cool!!
@demonsahil7841
@demonsahil7841 6 месяцев назад
thank u buddy, u helped a alot
@yanmezinskiy8817
@yanmezinskiy8817 5 лет назад
This is really cool tutorial :) Thank you a lot
@RandomVideosEveryDay
@RandomVideosEveryDay 3 года назад
Sugg: please use transformY and transformX instead top and left for smooth performance. Note* If using transform replace pageX and pageY to clientX and clientY.
@antonioarias8489
@antonioarias8489 3 года назад
a new sub. It´s amazing
@parampatel9998
@parampatel9998 3 года назад
AMAZING VIDEO THANKS!!!!!!!!!
@The-Biker-Bites
@The-Biker-Bites 5 лет назад
will do it definitely
@joshkloomie1752
@joshkloomie1752 5 лет назад
In this implementation I'd say no, with different cursors that are context aware (like telling where to swipe, scroll or a call to action like buy or contact), yes. I think it would be possible to create such a thing from this, but since i'm not that good with javascript I'd have to try around a little bit to find out.
@razenkellesly20
@razenkellesly20 5 лет назад
YES new designs LOVES it.
@frerosami7
@frerosami7 5 лет назад
I think that customize cursor is a great idea.
@_ranger_hridoy_6213
@_ranger_hridoy_6213 4 года назад
Thank you so much
@armandsalle8447
@armandsalle8447 5 лет назад
Really great video ! Hello from France
@mohammadvahedi78
@mohammadvahedi78 5 лет назад
thanks buddy for this amazing video ;)
@christophegarelli5838
@christophegarelli5838 5 лет назад
excellent, thank you so much!!
@skillzorskillsson8228
@skillzorskillsson8228 4 года назад
Will that really work to click links on the page tho? Since there is a div between the link and the actual cursor.... Anyway, If anyone have used this method for their site and noticed this problem it can be solved with pointer-events:none; in css. That allows you to click through a div
@FungsukWangdu
@FungsukWangdu 4 года назад
Hay this video is very exciting ! but I have single line on canvas and I want to change cursor to pointer as I hover over that line only. How can I achieve that?
@thallamrithesh6763
@thallamrithesh6763 5 лет назад
it is a great idea. thanks for such a good videos
@techwake360
@techwake360 5 лет назад
thats it what i m looking for? thanks.. and awesome
@debbieolivero4457
@debbieolivero4457 2 года назад
Lâu quá rồi mới nghe anh Đức Phúc hát, thích quá đi thôi.
@arifhaiman5
@arifhaiman5 2 года назад
Wow it's helpful
@ManikMia-qv8oy
@ManikMia-qv8oy 3 года назад
Great Stuff!!!
@puneetkumar6
@puneetkumar6 5 лет назад
Love your videos 🤘
@טלעמית-מ9כ
@טלעמית-מ9כ 3 года назад
great idea
@puigdelopez
@puigdelopez 3 года назад
Thank you so much!
@Merko2
@Merko2 5 лет назад
For a normal webpage, you probably won't do it. But i think there's some cool cases where you can use custom animated cursor like these for some cool stuff :) (Other than gaming). Great tutorial!
@BlackJacketJones
@BlackJacketJones 2 года назад
will you make a video that teaches how to use custom cursor svg's for hover and click?
@justineontita
@justineontita 5 лет назад
yea it's cool if used on let's say portfolio but not an e-commerce site
@aslambekeskhadzhiev1414
@aslambekeskhadzhiev1414 5 лет назад
Is this possible with WordPress? Looks great!
@anfas184
@anfas184 3 года назад
yes the method is the same , no extra twitch is necessary
@domanickharper
@domanickharper 3 года назад
Yes custom cursors are great especially for gamification of a site
@birsingh5388
@birsingh5388 5 лет назад
Good one 👍
@magicwand2851
@magicwand2851 4 года назад
I really appreciate your video, and I have a question, can you share with us how to hide the cursor in mobile mode? Thanks again!
@govt.job-bangladesh
@govt.job-bangladesh 2 года назад
Could you get any solution?
@adrianrios8597
@adrianrios8597 2 года назад
wow this is so good! How can I make the hover effect? when hovering over an object and doing an effect on hover I would appreciate if you help me bye friend
@FlockofSmeagles
@FlockofSmeagles 7 месяцев назад
For general use? Probably not. For your portfolio, sure.
@cadrissilver
@cadrissilver 3 года назад
yes
@ishaanpandey
@ishaanpandey 3 года назад
tysm
@arthurshaidullin7981
@arthurshaidullin7981 5 лет назад
thank you, i use cursor.classList.toggle("expand");
@kalush81
@kalush81 5 лет назад
Your imagination works so well :) I wish of mine does the same. You makes great tutorials. Sub up, and greetings.
@marlonjareck7367
@marlonjareck7367 2 года назад
Great! But how i add a trail to the animation?
@RumenGeorgieff
@RumenGeorgieff 4 года назад
I've tried it on a WordPress site, but it didn't work.
@demobbits7620
@demobbits7620 5 лет назад
I loved it. Great!....
@pranavbedre7841
@pranavbedre7841 3 года назад
I created the cursor animation but now, the animation doesn't allow me to interact with my website components like the links and buttons. I also tried to change pointer-events to auto. Still no luck. The only fix I could arrive was is by letting the z-index stay at 0. Keeping it at 0 defeats the whole purpose of the cursor because it ends up hiding behind the dropdown menu and images. What am I doing wrong?
@alexschimmer2014
@alexschimmer2014 5 лет назад
It depends.. if it required then i would prefer to be change.
@karthikb.s8432
@karthikb.s8432 3 года назад
Thanks for the idea. I did this but got a problem, when I try to hover a div or click a div, the mouse pointer div comes in between so how to solve this problem. please help me.
@sohrabazami827
@sohrabazami827 Год назад
Hi Gary, I thank you for the intersting lecture about customizing cursor. it was precise and very interesting. I have a question though. I wan to create a big crosshair which moves with mouse move, except that this crosshair is as big as my display window in the .html file. then i want the horizontal and vertical lines of the cross hair be the size of my display window. i also want the horizontal and vertical arms of crosshair move vertically and horizontally as i move curser up/down and left/right on the window. i also want to add a square in crossing point of this big crosshair and move on an image and capture a piece of the image for measurement of a physical phenomenan, do you have any idea how to go around this? thank in advance.🙏
@MandyFC1
@MandyFC1 5 лет назад
Custom Cursor, in the right place are good. ie. an email link could use an envelope cursor, but for links, and buttons I would avoid it.
@elf3994
@elf3994 4 года назад
yes for my dark animae background
@jager0724
@jager0724 5 лет назад
Customizing the cursor, yes or no? Depends on the niche. Interesting websites like css tricks, whose sole job is to look cool and teach other people how to do it, should have specialised cursors. In fact, they must! Like the custom scrollbar, it's their bread and butter. Social media sites could also get a lot of use out of them; expose their cooky side a little bit. Professional websites, on the other hand as well as your own portfolio should not. They should utilise css differently and kick ass on other fronts.
@ohgod7539
@ohgod7539 4 года назад
First of all, as to customizing cursors, yes, yes, yes. I mean, why NOT? To not do so would be like living in a house with no decorations. Secondly, I use a program called CursorFX and while I can create and basically put together a cursor package, each added cursor has a little area for an added 'script' in order to animate it. Do you happen to know, by any chance, if these scripts you cover might work for that? Thanks!
@ArmaanM123
@ArmaanM123 2 года назад
Also at 12:00 instead of set atribute, you could use get elementbyid('curser).style.top = ...
@closertube4482
@closertube4482 3 года назад
would mind helping me by making another video on how to prevent mouse cursor not go out of the body of the web page which may be useful on a systems like online exam system please
@chrisrubenstein
@chrisrubenstein 11 месяцев назад
I get an error Cannot read properties of null (reading 'setAttribute'). Cursor doesn't move with my mouse. Just stays static in upper left corner.
@thellexacademy
@thellexacademy 5 лет назад
I love this
@AshishNallana
@AshishNallana 3 года назад
This may have a problem, when the user removes his cursor from the browser window the cursor stays at the edge...what can be the the solution to remove this issue ... Can we use the mouseout event in js
@anantpratap1165
@anantpratap1165 7 месяцев назад
use window.onmouseout = (e) =>{ cursor.setAttribute("style", "display : none;") }
@Malaloeil
@Malaloeil 4 года назад
Hi Gary, is it possible to change the cursor but not to the entire , but just a div for example, so i can use multiples cursor in different places for example ? How would you do that to choose a class div with your code?
@Alex_192.
@Alex_192. Год назад
you can just put the cursor thing into .className instead of body in CSS
@oliwierpeciak2704
@oliwierpeciak2704 3 года назад
TypeError: Cannot read property 'setAttribute' of null
@pescovisck
@pescovisck 5 лет назад
How about create a custom cursor with clip-path? That would be awesome!
@amined801
@amined801 5 лет назад
i think it is cool sometimes
@yanmezinskiy8817
@yanmezinskiy8817 5 лет назад
Can you make a video about how SVG works with CSS on a webpage? :)
@user-not-found-97
@user-not-found-97 4 года назад
Hey broo ... Successfully worked this same cursor, but this my container also moving up-down when i click on screen y??.. Please ... some help..
@youssefmuhamad3213
@youssefmuhamad3213 5 лет назад
This remember me of blogspot and flas, but waaaaaaaay better
@jaccunningham
@jaccunningham 7 месяцев назад
You mentioned there was a CSS only code. I added the CSS but it is not working. Is there another step? Hoping you still reply to this video :)
@nahidjoy03
@nahidjoy03 5 лет назад
Awesome.!!!
@alperburakpusar
@alperburakpusar 3 года назад
When i scroll down page with middle mouse button or press buttons on header, page scrolling down as it's supposed to be, but that custom cursor stays where it is until i move again mouse. So above or under sections. I used codes from codepen. What is the problem? when i do that; html { height:100% overflow: hidden; } body { height: 100%; overflow-y: scroll; overflow-x: hidden; } This problem is solved. But it causes a few undesirable situations in other elements. Is there another option to solve this?
@mikopanjean8756
@mikopanjean8756 5 лет назад
Hello, Love to watch your helpful RU-vid videos. A small Q. Could you please do small tutorial about SignalR 1.10 .net Core with Angular 7 It would be very appreciated. thank you
@tchackeg9370
@tchackeg9370 4 года назад
How to get this cursor in your whole page , i can only get it at the home page, when i scroll it goes away.
@vhdpmota
@vhdpmota 5 лет назад
Hello, thank you very much for the tutorial, I am trying to implement it in my own project but I don't know how to make the cursor change when it is on a link of type "a" you think you could help me. Greetings, thanks your tutorials are magnificent!
Далее
Awesome UI Interactions with the CSS Clip Path Property
16:15
Учёные из Тринидад и Тобаго
00:23
МАЛОЙ ГАИШНИК
00:35
Просмотров 553 тыс.
БАГ ЕЩЕ РАБОТАЕТ?
00:26
Просмотров 226 тыс.
Award Winning Animation With Only 20 Lines Of CSS?
6:59
The Easy Way to Design Top Tier Websites
11:54
Просмотров 453 тыс.
Top 10 CSS One Liners That Will Blow Your Mind
13:34
Просмотров 964 тыс.
Awesome Cursor Animation With CSS  & Javascript!
18:36
Просмотров 148 тыс.
Award Winning Elastic Cursor Follow Animation
4:55
Просмотров 232 тыс.
JavaScript Pro Tips - Code This, NOT That
12:37
Просмотров 2,5 млн
These CSS PRO Tips & Tricks Will Blow Your Mind!
8:48
Просмотров 367 тыс.
Учёные из Тринидад и Тобаго
00:23