Forum Moderators: open

Message Too Old, No Replies

Display Hourglass until image loaded

show hourglass mouse pointer until an image is loaded

         

walker

10:59 am on Mar 24, 2003 (gmt 0)

10+ Year Member



Hi

When using DHTML and Javascript transitions eg fading in a picture the loading status at the base of the browser screen will often finish thus making a page that is still loading an image appear blank.

Is there a way of making the Mouse pointer an hourglass until the image is completely loaded?

Kind Regards

Rod

gph

11:49 pm on Mar 24, 2003 (gmt 0)

10+ Year Member



This seems to work in IE6. I've never applied a style to the body with JS so the syntax could be wrong for Moz.

<script type="text/javascript">

function Check_Img() {
if (document.getElementById('my-image').complete) {
clearInterval(img_timer)
document.body.style.cursor = ''
}
}
</script>

</head>
<body>
<script type="text/javascript">

document.body.style.cursor = 'wait'

</script>

<img id="my-image">

<script type="text/javascript">

img_timer = setInterval('Check_Img()', 250)

</script>


IE6 also supports 'progress'

[msdn.microsoft.com...]

gph

12:12 am on Mar 25, 2003 (gmt 0)

10+ Year Member



I over thought that, this is simpler.

<style type="text/css">

body {
cursor: wait;
}

</style>

<script type="text/javascript">

function Check_Img() {
if (document.getElementById('my-image').complete) {
clearInterval(img_timer)
document.body.style.cursor = 'default'
}
}
</script>

</head>
<body>

<img id="my-image">

<script type="text/javascript">

img_timer = setInterval('Check_Img()', 250)

</script>