Scrollbar in Javascript or CCS

Need technical advice on coding your web pages? Covers HTML, JavaScript, CSS, and some server side technologies. Also the issue of some webpages not displayed well.

Moderator: Don_HH2K

Scrollbar in Javascript or CCS

Postby horhe_ozuba » Mon 29 Aug, 2005 1:08 am

This is my problem:
I have a scrollbar with position always defaulted to the topmost part of the page (Page 1) upon load. Also, I have another page (Page 2) that I nagivate to from Page 1. Whenever i click the Back button in Page 2 to navigate back to Page 1, the scrollbar always stays in the top most part of the page. This i think is due to calling a CCS scroll class with property overflow set to auto:

.scroll
{
overflow: auto;
background-color: #fef6d6
}


Is there a way for me to update this current setup such that the scrollbar position will stay to where i left off in Page 1 if I reload the page (via the Back button in Page 1)?
UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; T312461; .NET CLR 1.0.3705)
just me!
horhe_ozuba
new member
new member
 
Posts: 4
Joined: Mon 29 Aug, 2005 12:57 am

Postby Antony » Mon 29 Aug, 2005 1:11 am

Is the scrollbar the one from browser or the one you created (for dynamic HTML etc)?
UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/412.6.2 (KHTML, like Gecko) Safari/412.2.2
User avatar
Antony
diamond member
diamond member
 
Posts: 14511
Joined: Tue 18 Jun, 2002 11:36 pm
Location: Sydney, Australia

Postby horhe_ozuba » Mon 29 Aug, 2005 1:39 am

The scrollbar is something I created.
UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; T312461; .NET CLR 1.0.3705)
just me!
horhe_ozuba
new member
new member
 
Posts: 4
Joined: Mon 29 Aug, 2005 12:57 am

Re: Scrollbar in Javascript or CCS

Postby Antony » Mon 29 Aug, 2005 1:45 am

Okay,

Back to your question.

horhe_ozuba wrote:Is there a way for me to update this current setup such that the scrollbar position will stay to where i left off in Page 1 if I reload the page (via the Back button in Page 1)?
it would be a bit hard. Unless you want to record the scrolling position (e.g. stored in cookie), but I would suggest you not to worry about this.
UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/412.6.2 (KHTML, like Gecko) Safari/412.2.2
User avatar
Antony
diamond member
diamond member
 
Posts: 14511
Joined: Tue 18 Jun, 2002 11:36 pm
Location: Sydney, Australia

Postby horhe_ozuba » Mon 29 Aug, 2005 1:54 am

In fact, I thought I'm done and didn't care about this scroll thing. But one main requirement is to implement this screen behavior. :(

I have been searching the net for some tips but there's just a churn of info that i couldn't get to one clear and working approach.

Anyways, let's say I store the old position of the scrollbar , <strikethrough>how would this work?</strikethrough> I meant how should this be done in javascript code?

I very much appreciate the help!
Thanks so much!
UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; T312461; .NET CLR 1.0.3705)
Last edited by horhe_ozuba on Mon 29 Aug, 2005 1:56 am, edited 1 time in total.
just me!
horhe_ozuba
new member
new member
 
Posts: 4
Joined: Mon 29 Aug, 2005 12:57 am

Postby horhe_ozuba » Mon 29 Aug, 2005 2:38 am

It seems that i can get the position of the scrollbar via:

document.body.scrollLeft;
document.body.scrollTop;

Is it possible for the values of these properties to be modified such that the position of the scrollbar changes? How is this done?

==============================

I realized after testing that the scrollLeft and scrollTop didn't work as i expected. The properties apply to the entire IE page and not the area i expected to change. (GRIEF ...!!!!).
UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; T312461; .NET CLR 1.0.3705)
Last edited by horhe_ozuba on Mon 29 Aug, 2005 2:47 am, edited 1 time in total.
just me!
horhe_ozuba
new member
new member
 
Posts: 4
Joined: Mon 29 Aug, 2005 12:57 am


Return to Web Design and Page Coding

Who is online

Registered users: Alexa [Bot], Amrad, Google [Bot], Majestic-12 [Bot], Yahoo [Bot]