Forum Moderators: open

Message Too Old, No Replies

this script needs a finishing touch

         

raph

10:52 am on Nov 29, 2004 (gmt 0)

10+ Year Member



on the following page you'll find a javascript which makes a div scroll with your own custom arrows.
[193.109.189.1 ]

the script can be seen in action here:
[193.109.189.1 ]

In my "scrollable" div I have a whole set of links that refresh the page when clicked (these links send variables to the url then the page refreshes). Everytime a linked is clicked the right-content changes (simulating a frameset without the frames)

There was one big problem that is almost solved now:
When the user clicked a link in the scrolldiv, the page refreshes and loses the vertical position of the div.
To solve that problem I made a function that sends the vertical position to the url and when the page refreshes, the page just has to read the url to know which position the div was.

Everything works but when the user clicks a link, the div resets itself to the initial position and then shifts to the right position.

Is there any way to prevent this "shift" or should i just go back to where I came from and use the good ol' frames?

Another thing: There's no problem whatsoever in Safari

orion_rus

8:49 am on Dec 1, 2004 (gmt 0)

10+ Year Member



Why don't u simple hide right div's content and show another divs content there?

raph

9:45 pm on Dec 1, 2004 (gmt 0)

10+ Year Member



I'm not sure I understand, could explain this some more?

orion_rus

11:11 am on Dec 3, 2004 (gmt 0)

10+ Year Member



Ok i think to solve ur problem there are two ways.
1) u have right div where u need to place a content. This content forms when user clicks to the point in the left div. Your content shall forms like follows:

var txt=document.createTextNode("Hi! i'm new!");
var elem=document.getElemtById(Name of your content div);
var oldTxt=elem.replaceChild(txt,elem.firstChild);

this code can be modiefied if you would like to place images there and so on
2) u have many divs each with it's own content. And when u click to point from the left div u need to hide oldcontent div and show there div with newcontent. Like follows:

var Newdiv;
var Olddiv;
function change(newnamediv);
{Olddiv=Newdiv;
Newdiv=getElementById(newnamediv)
Olddiv.style.visibility="hidden";
Newdiv.style.visibility="visible";
}

U can solve ur problem with other ways of cause. I show u the common. But u don't need when to save location of the left div and so on...
Good luck

raph

1:38 pm on Dec 6, 2004 (gmt 0)

10+ Year Member



Ok thanks, sorry I replied so late.
I will certainly give this approach a shot!
Thanks a lot.