Solved

javascript scroll to anchor

Posted on 2008-06-20
2
5,512 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Problem to refer to value 8 49
Places to advertise 6 35
Select case on click 3 16
Call a function within the ASP code 4 12
Developer tools in browsers have been around for a while, yet they are still heavily underused by developers. Developers still fix html or CSS then refresh page to see effect, or they put alert or debugger in JavaScript and then try again and again …
Thoughout my experience working on eCommerce web applications I have seen applications succumbing to increased user demand and throughput. With increased loads the response times started to spike, which leads to user frustration and lost sales. I ha…
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…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…

809 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