Cursor invert color (black/white text)
-
This post is deleted!
-
@Richard Hello, I wanted to have a cursor with mix blend mode and I was able to do it by using the code written here.
The only problem is that when I go from a page to another it stop to work, and the cursor become invisible.
Does anyone have any ideas on why that happen?
Many thanks,
Alberto -
yea this code:
<script> window.laytheme.on("newpageshown", function(layoutObj, type, obj){ jQuery("body").append('<div class="pointer"></div>'); jQuery("body").on("mousemove", function(e) { jQuery(".pointer").css({ top: e.clientY + "px", left: e.clientX + "px" }); }); }); </script>
its wrong, because it adds a new pointer div everytime you go to a new page ^^
just do it like this instead:
jQuery(document).ready(function(){ jQuery("body").append('<div class="pointer"></div>'); jQuery("body").on("mousemove", function(e) { jQuery(".pointer").css({ top: e.clientY + "px", left: e.clientX + "px" }); }); })
-
@arminunruh Thank you so much! It works perfectly now.
-
@XLD @Richard thanks for having this function explained, I bump into the same thing of also having the default "arrow cursor" still visible. How did you did you solve this in the end?
Many Thanks!
https://lenawinterink.com/category/test-work-category/ -
-
ur website runs so fast wow even here in brazil. which webhost did you get or which caching plugin do you use?
-
Thank you for this topic and the explanations. One question: How do I manage to use the same effect, but use a customized .svg as shape? I'm stuck at the moment...
-
Ok so first off, if anyone just wants a inverted cursor, i think this should be the correct code:
In "Custom CSS":
*{ cursor: none!important; } .pointer { cursor: none; background-color: #fff; position: fixed; text-align: center; width: 52px; height: 52px; z-index: 1000; transform: translate(-50%, -50%); pointer-events: none; mix-blend-mode: difference; overflow: hidden; border-radius: 50%; }
in HTML at bottom:
<script> jQuery("body").append('<div class="pointer"></div>'); jQuery("body").on("mousemove", function(e) { jQuery(".pointer").css({ top: e.clientY + "px", left: e.clientX + "px" }); }); </script>
previous code was using newpageshown to add the pointer div, but then it means it adds a new one every time you navigate on the page, thats not needed
-
to use a svg image, use https://developer.mozilla.org/en-US/docs/Web/CSS/background-image
in HTML at bottom:
<script> jQuery("body").append('<div class="pointer"></div>'); jQuery("body").on("mousemove", function(e) { jQuery(".pointer").css({ top: e.clientY + "px", left: e.clientX + "px" }); }); </script>
In "Custom CSS":
*{ cursor: none!important; } .pointer { cursor: none; position: fixed; text-align: center; width: 52px; height: 52px; z-index: 1000; transform: translate(-50%, -50%); pointer-events: none; mix-blend-mode: difference; overflow: hidden; border-radius: 50%; background-image: url("http://localhost:10020/wp-content/uploads/2024/09/close-button.svg"); background-position: center; background-repeat: no-repeat; }
this is the part u change:
background-image: url("http://localhost:10020/wp-content/uploads/2024/09/close-button.svg");get the url from wp-admin media library, when u click on an image u get File URL:
Need custom programming for your Lay Theme site?
I regularly add new features to Lay Theme for free, based on user feedback. But if you or your client need something more specific, I’m happy to offer custom paid programming tailored to your project.
Email info@laytheme.com with the subject "Custom paid programming for Lay Theme" and a short description of what you need — I’ll reply with a cost estimate.
Custom features I build often make it into future Lay Theme updates, so your idea might benefit the whole community.
Before you post:
- When using a WordPress Cache plugin, disable it or clear your cache.
- Update Lay Theme and all Lay Theme Addons
- Disable all Plugins
- Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"
This often solves issues you might run into
When you post:
- Post a link to where the problem is
- Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
- If the problem is difficult to explain, post screenshots / link to a video to explain it