Solved

javascript scroll to anchor

Posted on 2008-06-20
2
5,505 Views
Last Modified: 2008-06-20
Here is the issues im running into....

I have a page that loads a modal which loads a remote page that has a bunch of text in it.

I load the modal via jquery.

I need to have javascript or whatever scroll to a anchor on the page. right now im storing the anchor in a cookie. So lets say I have 3 anchors, they are named 1, 2, 3 in the cookie when someone clicks on link 2 it stores "2" into the cookie when the modal loads I need i to look a the cookie and scroll to that number.

One of the issues is it cannot reload the page so a window.location... will not work because that actually closes down the modal.

Any solutions that anyone can think of???

Thanks
0
Comment
Question by:aumudin
2 Comments
 
LVL 48

Accepted Solution

by:
hernst42 earned 500 total points
ID: 21835491
does it work if you use:
window.location.hash = '#anchorname';

It shouldn't reload the page, but jump to the anchor.
0
 
LVL 4

Author Comment

by:aumudin
ID: 21835499
That did the trick I figured out what I did wrong when I tried that(first thing I tried) I didnt have the # just had the name of the anchor.... Thank you for helping me hernst!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
Foolproof security solutions has become one of the key necessities of every e-commerce or Internet banking website. If you too own an online shopping site then its vital for you to equip your web portal with customer security features that can allow…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now