- Create Account

Move divs automatically

Forums > DragResize > Move divs automatically
Author
Message

1) Fredric Group: Guests
IP: 78.24.--.--
Dear Angus,

I have stumbled upon your great DragResize script, but I am having problems modifying it the way I want.

What I want is to move a div outside the screen (left: -2000px; top: -2000px) when the page is loaded, and after 4 seconds I want it to be moved back into the visible field (left: 0px; top: 0px; height: 100%; width: 100%;). The reason why I want this is that the div contains a mediaplayer object which I want to hide while it buffers.

Any ideas on how to modify the code to do this?

All answers appreciated!

2) Angus Turnbull Group: Moderators
Posts: 4235 Joined: 7 Dec 2003 Location: New Zealand IP: 202.137.--.--
There's no reason why you need to use this script to accomplish that! Simply position it offscreen using CSS and use a short setTimeout() at some point to call a function that sets its position to where you want it.

However, that raises questions about accessibility. Most users are used to media players buffering, and 4 seconds is a rather arbitrary time (some of your users will be on dialup and some on 100mbit+ broadband, after all). Why not just leave it the way it is in the middle of the page like every other website?

- Angus.

Post a Reply:

You are not logged in, and will be posting anonymously as a guest. If you want to post using an account, please login at the top of this page.