Shoutbox

better solution for window.scrollTo(x,y), onload is too slow. - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: better solution for window.scrollTo(x,y), onload is too slow. (/showthread.php?tid=85931)

better solution for window.scrollTo(x,y), onload is too slow. by .Roy on 09-14-2008 at 06:55 AM

Currently im using:
<body onload='window.scrollTo(6,112)'>

but onload only activates when the whole page is loaded which might take a long time since the page has a lot of content.

how do i make the window.scrollto happen as soon as that part of the code is loaded?


RE: better solution for window.scrollTo(x,y), onload is too slow. by NanaFreak on 09-14-2008 at 07:17 AM

you could always put it in <script> at the end of the page... but other than that you would have to wait until the whole page has loaded unless you know that 6,112 has loaded and is able to scroll there...


RE: better solution for window.scrollTo(x,y), onload is too slow. by Felu on 09-14-2008 at 07:40 AM

Remove other content from page. Scroll to 6,112. Load other content using js/ajax?

Get what I mean?


RE: better solution for window.scrollTo(x,y), onload is too slow. by segosa on 09-14-2008 at 10:46 AM

put <script type="text/javascript">window.scrollTo(6,112);</script> into the HTML at the place that you know is approximately the location of (6, 112).


RE: better solution for window.scrollTo(x,y), onload is too slow. by Nathan on 09-14-2008 at 11:41 AM

Use jquery, and there is the document.ready function, which executes whatever is in it as soon as the headers are requested.


RE: RE: better solution for window.scrollTo(x,y), onload is too slow. by segosa on 09-14-2008 at 11:47 AM

quote:
Originally posted by Nathan
Use jquery, and there is the document.ready function, which executes whatever is in it as soon as the headers are requested.

It executes on DOMContentLoaded i.e., when the page's source code has been downloaded and the DOM can be manipulated - meaning images may not be loaded yet.

As far as I'm aware window.onload and co only execute once images have been loaded too.

http://docs.jquery.com/Events/ready

Edit: oh, and it's $.ready.
RE: better solution for window.scrollTo(x,y), onload is too slow. by Felu on 09-14-2008 at 11:57 AM

quote:
Originally posted by segosa
put <script type="text/javascript">window.scrollTo(6,112);</script> into the HTML at the place that you know is approximately the location of (6, 112).
Woah... didn't know this could be done in such a way. I always thought JavaScript was executed after the page loaded itself.
RE: better solution for window.scrollTo(x,y), onload is too slow. by .Roy on 09-14-2008 at 12:54 PM

what do i do if this page is basically an iframe of another site.
where would i go about putting the <script type="text/javascript">window.scrollTo(6,112);</script>

if the iframe is the only code on the page basically.


RE: better solution for window.scrollTo(x,y), onload is too slow. by Felu on 09-14-2008 at 12:56 PM

quote:
Originally posted by .Roy
if the iframe is the only code on the page basically.
Put the code in page that is the source of the iframe? If you pull that from some other site you don't have access to... get a php script to pull the code, edit it and put the js and then display it.
RE: better solution for window.scrollTo(x,y), onload is too slow. by .Roy on 09-14-2008 at 01:02 PM

quote:
Originally posted by Felu
quote:
Originally posted by .Roy
if the iframe is the only code on the page basically.
Put the code in page that is the source of the iframe? If you pull that from some other site you don't have access to... get a php script to pull the code, edit it and put the js and then display it.
yes the code is from an external website and if i pull the code it won't work because whatever i'm trying to get from thier site only works on their site.

(tested by copying source onto html document and it didn't work)

any other solutions?

this is the page btw:
http://www.zomganime.com/mv.php?id=LG0NA8O6
im kind of using 2 iframes to get only the player:

http://www.zomganime.com/code-geass-lelouch-of-th...ion-r2-episode-23/
(look at the bottom video on that page)

but sometimes it takes too long and you can see the megavideo logo so yeah...
RE: better solution for window.scrollTo(x,y), onload is too slow. by segosa on 09-14-2008 at 02:42 PM

wtf does it matter scrolling down 100 pixels to the video? It's completely unnecessary.


RE: better solution for window.scrollTo(x,y), onload is too slow. by ShawnZ on 09-14-2008 at 02:52 PM

he wants to make it look like he's not hotlinking to megavideo videos \o/



why not just embed the video, like you're supposed to do in this exact situation? :<


RE: better solution for window.scrollTo(x,y), onload is too slow. by .Roy on 09-14-2008 at 05:01 PM

megavideo is currently having problems with their embed video player which makes all videos show as unavailable.

:O so please stop going offtopic and if u got a solution post it onegai.


RE: better solution for window.scrollTo(x,y), onload is too slow. by ShawnZ on 09-14-2008 at 05:16 PM

embed the video like this?

<embed width="484" height="418" src="http://wwwstatic.megavideo.com/mvplayer.swf" flashvars="un=205d86eaddc2d41e13d0df6fe9d93a8f&k1=22919&k2=91075&s=165&v=LG0NA8O6">


RE: better solution for window.scrollTo(x,y), onload is too slow. by .Roy on 09-14-2008 at 05:24 PM

ok upload a page with that code on it and i wanna see ;_;.


RE: better solution for window.scrollTo(x,y), onload is too slow. by ShawnZ on 09-14-2008 at 05:33 PM

you do it!


RE: better solution for window.scrollTo(x,y), onload is too slow. by .Roy on 09-14-2008 at 09:04 PM

the player shows but theres no video and it says connection problem :).
happy?

any solutions for the original question?


RE: better solution for window.scrollTo(x,y), onload is too slow. by ShawnZ on 09-14-2008 at 09:05 PM

stop asking the original question. find a better way.


RE: better solution for window.scrollTo(x,y), onload is too slow. by .Roy on 09-15-2008 at 07:48 AM

T_T this is the best solution.


RE: better solution for window.scrollTo(x,y), onload is too slow. by segosa on 09-15-2008 at 08:21 AM

we already gave you a solution: scrolling down 100 pixels is not only stupid but also useless.


RE: better solution for window.scrollTo(x,y), onload is too slow. by .Roy on 09-15-2008 at 10:50 AM

no sir its not useless.