Log in

View Full Version : looking for a code, please help



kaymarie
06-19-2008, 12:27 AM
hey everyone!
I lost a code of which i believe i found on this site. Ive been searching for at least an hour on and off dynamic drive to find this code, if you know where it is, or can point me in the right direction, that would be great.

The code was one that had a series of links on the top, if you clicked on one, it would smoothly scroll down the page to the paragraph. Then, you could click on a "return to top" button, where it would scroll back up to the top of the page. What was really neat about this code was that all of the paragraphs were a light beige colour, and after viewing a paragraph it will change to a darker colour.

I know this is a very vague description, but any help would be most appreciated.

Thanks!

Medyman
06-19-2008, 12:08 PM
I haven't seen that kind of script on Dynamic Drive. That doesn't mean it doesn't exist though.

But it's quite common functionality that's found elsewhere on the web.

Is this (http://www.dezinerfolio.com/2007/08/08/df-javascript-smooth-scroll/) what you're looking for? You could also look into jQuery (http://jquery.com/) and the scrollTo plugin (http://flesler.blogspot.com/2007/10/jqueryscrollto.html).

JavaScript does have a native scrollTo() (http://www.w3schools.com/HTMLDOM/met_win_scrollto.asp) method, but the results aren't as smooth as those mentioned above.

magicyte
06-23-2008, 04:57 PM
Well, actually there is a much more simpler way of scrolling to the top, bottom, or just some out of the way paragraph just by clicking a link. I will leave a small code piece just to give you an idea. Quite in fact, though, it does not involve JavaScript, but plain HTML. Hope it helps! Here it is:

<html>
<head>
<title>NONE
</title>
</head>
<body>
<a href="#some_name">Go to P1</a>
<a name="some_name">P1</a>
YADAYADAYADAYADAYADA!!!
</body>
</html>


I am a little bit fuzzy on HTML concepts, but this should help. Let me know if it does!


Magicyte