/    Sign up×
Community /Pin to ProfileBookmark

Scroll To help! confused..

Hi all!

I have a little problem. I am making a basic website and I wanted a scrollto function but I have no idea how to start.

I wanted that if you click on a link say for example “25th May” it would go to a different page where the text is but scroll or jump to that section.

Does anyone have any ideas of how to go about this?

Thanks in advance!

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@PadonakMay 13.2012 — you have to put the proper anchor in the next page markup - something like this:

[code=html]<a name="25_may"></a>
<p>bla-bla-bla</p>[/code]


and then add the name of this anchor as a part of url in the href attribute of the link on you first page:

[code=html]<a href="nextpage.htm#25_may">25th May</a>[/code]

the part aftrer the [B]#[/B] sign is called 'hash'.
Copy linkTweet thisAlerts:
@cootheadMay 13.2012 — Hi there jamesy23,

you do not need javascript to achieve this. ?

Give an id - ( let's say [color=red]id="may25"[/color] ) to an element, it does not necessarily have to be the [i]a element[/i],

to which you wish to scroll, then use this code...
[color=navy]&lt;a href="the-new-page.html[color=red]#may25[/color]"&gt;25th. May&lt;/a&gt;
[/color]

[i]coothead[/i]
×

Success!

Help @jamesy23 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...