...

View Full Version : jQuery loading external html in a DIV question



saltarella
10-15-2009, 08:29 PM
Hi everybody,
Im loading a div of an external html (#right_in) into a div (#right) in my main movie this way:


var toLoad = divobj.id+'.html #right_in';

function loadContent() {
$('#right').load(toLoad);
showNewContent();
}
function showNewContent() {
$('#right').fadeIn(800);
}


Is it possible to specify that the DIV has to load always at y=0, ie from the top?
Because when I load another external div into my main div firefox keeps the latest position (if I scrolled before it loads the new page at that point).

Any help is very appreciated!
Thanks in advance

Fumigator
10-15-2009, 08:44 PM
Are you talking about using Javascript to scroll the window? Try the scrollto method.

http://www.w3schools.com/jsref/met_win_scrollto.asp

saltarella
10-15-2009, 08:50 PM
does it work also to scroll the content of a DIV only?

saltarella
10-15-2009, 08:53 PM
I try to explain it better: since you can scroll the container DIV (#right), when you scroll it and stop at 1/3 and than click the button that loads another DIV into #right firefox loads the next DIV also at 1/3. Do you know what I mean?

I also have an anchor called "1" at the top of each external html, but it doesnt seem to work to simply add #1

var toLoad = divobj.id+'.html#1 #right_in';

I was hoping is just a syntax mistake ...

Fumigator
10-15-2009, 09:13 PM
when you scroll it and stop at 1/3 and than click the button that loads another DIV into #right firefox loads the next DIV also at 1/3.

Interesting... I suppose if you remove the div you're loading, then recreate it, the scroll position will reset.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum