dshongphuc / magic-mouse-js

A lightweight javascript library to create some amazing effects for the mouse (cursor) on your website - MagicMouse.js : https://magicmousejs.web.app/
MIT License
389 stars 60 forks source link

Unable to `customize` cursor #31

Closed realhackcraft closed 1 year ago

realhackcraft commented 1 year ago

I have a completely white UI and want to change the cursor colour to rgb(175, 175, 175)(grey). I used the cdn.min.js file, and changed the magic-mouse.css. The changes do not reflect on my page.

dshongphuc commented 1 year ago

hi @realhackcraft , all you need to do is change style for the body #magicPointer and body #magicMouseCursor

realhackcraft commented 1 year ago

There is no effect if I do that on the newest version. However, when I copy the magic-cursor.js from https://www.lucammello.com, I can get it to work.

realhackcraft commented 1 year ago

magic_mouse.js.zip This one works, and the one included in your repo does not.

realhackcraft commented 1 year ago

I cannot customize the colour because at the beginning there is const STYLE and you set the style of the cursor there, I think.

realhackcraft commented 1 year ago

from 5:255 to 5:1215

dshongphuc commented 1 year ago

@realhackcraft Thank you for sharing, did you try to add !important to your styles?

realhackcraft commented 1 year ago

can you show me an example? im bad at css

dshongphuc commented 1 year ago

@realhackcraft For example if you want to change the border & background of the cursor to red color:

body #magicMouseCursor {
  border: 1px solid red !important;
}
body #magicPointer {
  background: red !important;
}
realhackcraft commented 1 year ago

what does !important mean?

dshongphuc commented 1 year ago

@realhackcraft well, in css, we have priority of selector. So if a selector has an !important property, it will have the highest priority. Basically you use that to override my CSS in magicmouse.js file

realhackcraft commented 1 year ago

image