Forum Discussion
Change mouse cursor on rollover or use a custom image for cursor
Is it possible to use a custom mouse cursor for an interaction, or change the mouse cursor to an image instead of the pointing hand?
I have been asked to do this and I can't figure out a way to make it happen.
Thank you so much for your help!!
Hi William!
You are welcome to share your thoughts with our product development team here.- CoryWarshawsky-Community Member
Much like Dan, I want to be able to "hijack" the learner's actual mouse cursor.
An example usage: I'd love for the learner's mouse to become a pen. As soon as the learner's cursor moves from anywhere on their desktop to landing over the storyline file, I want the cursor to become the pen. (or at least automatically have an image of a pen hover directly under it.)
Here is an example of a website that does this: http://www.3h-i.com/
Would be extra cool if the pen was a highlighter and the learner could actually highlight something on screen. Or the cursor automatically left a translucent yellow line as the learner moved it across a slide.
- AlexPaniaguaCommunity Member
Hola, puedes cambiar el cursor con un accionador de JS
var elementToChange = document.getElementsByTagName("body")[0];
elementToChange.style.cursor = "url('URL-A-LA-IMAGEN-PUEDE-SER-PNG-DE-UNOS-40px'), auto";
para regresarlo al cursor normal:var elementToChange = document.getElementsByTagName("body")[0];
elementToChange.style.cursor = "default";Saludos
- NaveeraAshrafCommunity Member
Hi all!
I have managed to change my cursor to a custom image using JavaScript. But it doesn't change the pointer cursor (the little hand icon) when hovering over the links. any idea on how to change that?
- AlistairMontgomCommunity Member
Just to follow on from this. I have used the code example above to change the default cursor but when I hover over an interactive dial the cursor reverts back to the standard "pointer" finger. Any way to remove this hover state from the dial so my users see the custom cursor all the time?
- OrestMykyta-e8aCommunity Member
You're right. It seems that interactive elements handle their cursors separately. Here is the code that would change the cursor everywhere, include interactive elements like dials.
document.body.style.cursor = "url('cursors/rocket.ico' ), auto");
var styleElem = document.createElement("style");
styleElem.innerHTML = ".cursor-hover:hover *, .rotatable:hover * {cursor: url('cursors/rocket.ico' ), auto}";
document.head.appendChild(styleElem);The first line applies the cursor to most elements. The rest overrides Storyline's rules for setting the cursor on interactive elements.
You can replace "url('cursors/rocket.ico' ), auto" with any of the built in cursors like "move" or "grab" (see list here). Or use your own custom image. Just remember to add your custom image to the output folder after publishing, as described in a previous comment.
But as a forewarning: this is a bit more dependent on how Storyline publishes currently. It is possible that future releases might change things and it won't work. (I don't mean that a project you publish today will suddenly stop working, but if you need to update it a year from now, you might re-publish and find that the cursors are back to normal)
- AlistairMontgomCommunity Member
Amazing, that did it! Thank you.
I'm guessing this means that you could target different interaction types on a slide and use different cursors for sliders, dials, buttons etc...? Could make for some fun design elements.