Live Demo Download Script
jQuery Code
<script type="text/javascript" src="../jquery.js"></script> <script type="text/javascript"> $(document).ready(function() { $('#Cursor').css({cursor: 'crosshair'}); // Position the Cursor. var positionCursor = function(event) { /* Get cursor positions */ var tPosX = event.pageX-22; var tPosY = event.pageY-22; /* Set Cursor positions */ $('div#Cursor').css({top: tPosY, left: tPosX}); }; // Show (create) the Cursor. var showCursor = function(event) { if($.browser.mozilla) { $('#Cursor').show(); } else { var s = document.createStyleSheet(); s.addRule("*", "cursor: inherit"); s.addRule("body", "cursor: crosshair"); s.addRule("html", "cursor: crosshair"); } $('#Cursor').show(); positionCursor(event); }; // Hide (remove) the Cursor. var hideCursor = function() { $('div#Cursor').hide(); }; $('div#main').hover(showCursor, hideCursor).mousemove(positionCursor); });
HTML Code
<body> <div id="main"> <div id="Cursor"></div> </div> </body>
CSS Code
body{ cursor:crosshair;!important; } #main{ height:500px; width:700px; border:2px solid #d5d5d5; margin:auto; cursor:none;!important; } #Cursor { display:none; background-image:url(curs.gif); background-repeat:no-repeat; position: absolute;!important; height:50px; width:50px; z-index: 2; }
We would love to hear from you...