p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning HTML, XHTML, CSS, and JavaScript (http://p2p.wrox.com/forumdisplay.php?f=541)
-   -   Help with changing cursor to an image (http://p2p.wrox.com/showthread.php?t=78880)

andypandyrox456 April 6th, 2010 09:05 PM

Help with changing cursor to an image
 
Hello everyone!
In this book, it says how you can change the appearance of the cursor to different cursors, such as the hourglass, hand...
You can also change it to an image, but there is no sample code that tells me how to do this.
Can someone please give me a sample CSS code for this?
Let's suppose the image was called "image.png" and in the file "images," therefore the url will look like this - images/image.png

Thanks in advance!

PeterPeiGuo April 7th, 2010 10:38 AM

The following works in IE8, Safari and Chrome. Unfortunately not Firefox and Opera.

Code:

<html>
<head>

</head>
<body>
        <h1 onclick="document.body.style.cursor = 'url(3dsmove.cur), default';">Foo</h1>
</body>
</html>


andypandyrox456 April 7th, 2010 10:41 AM

Quote:

Originally Posted by PeterPeiGuo (Post 255990)
The following works in IE8, Safari and Chrome. Unfortunately not Firefox and Opera.

Code:

<html>
<head>

</head>
<body>
        <h1 onclick="document.body.style.cursor = 'url(3dsmove.cur), default';">Foo</h1>
</body>
</html>


Thanks!
I assume that this only takes .cur file extensions. Am I correct, or can it take .png or .jpeg or .gif also?
Second, can I save images as a .cur file in Paint? I tried it in a program called GIMP, and it didn't allow me to do that.
Third, in that code, it only sets the cursor for that specific <H1> element. Can I make it for the entire body?


All times are GMT -4. The time now is 03:59 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.