Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

javascript scroll to anchor

Posted on 2008-06-20
2
Medium Priority
?
5,519 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 48

Accepted Solution

by:
hernst42 earned 2000 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

Understanding Web Applications

Without even knowing it, most of us are using web applications on a daily basis. Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We often confuse these web applications tools for websites.  So, what is the difference?

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)

722 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