Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
|
I'm not sure history.go is the best way to do what you want, but since you're already using it here's what you'd likely want to do.
You can list a URL inside the parenthesis so for the page you linked to
Code:
history.go("http://www.mymusictheory.com/grade6/exercises/harmony6-harmonising-a-melody.html")
Now that won't change anything from what you're doing now, but it's the first step. What you want to do is create named anchors. Where you want the page to load find an element and give it an id.
For example say you wanted the page to reload so Chords Which Fit is at the top. Here's your code around that text.
HTML Code:
<h2><strong>Chords Which Fit </strong></h2>
Give the h2 an id
HTML Code:
<h2 id="top"><strong>Chords Which Fit </strong></h2>
With that done you can change the history.go like so
Code:
history.go("http://www.mymusictheory.com/grade6/exercises/harmony6-harmonising-a-melody.html#top")
Notice the #top at the end of the url.
You can have as many named anchors as you want on a page so if you decided to have more exercises on a page you could add ids to different parts of the page and then adjust the history.go method accordingly for where you want the page to reload to.
Hope that helps.
|