Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Need to automatically scroll to div from URL
Old 12-23-2008, 10:31 PM Need to automatically scroll to div from URL
Skilled Talker

Posts: 71
Trades: 0
I have a page that has several categories of lists. Each category starts with a div holding an image. I need to be able to make the page auto-scroll to the div based on the URL.

For example, say I have four categories, "cat1, cat2, cat3, cat4" (assume those are my div ID's). How can I make it auto scroll with something like, page.html#cat3?

I've tried Googleing but all I seem to get is scrolling divs and other irrelevant stuff.

Thanks.
CrazeDizzleD is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-24-2008, 05:22 AM Re: Need to automatically scroll to div from URL
stoot98's Avatar
Ultra Talker

Posts: 427
Name: Stuart
Location: Glasgow, Scotland
Trades: 0
Add a named anchor where you want to scroll to and then use the link page.html#anchorName
stoot98 is offline
Reply With Quote
View Public Profile
 
Old 12-24-2008, 07:08 AM Re: Need to automatically scroll to div from URL
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
with the id you don't need the named anchor. The ID can be used as the document fragment location.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-24-2008, 09:46 AM Re: Need to automatically scroll to div from URL
stoot98's Avatar
Ultra Talker

Posts: 427
Name: Stuart
Location: Glasgow, Scotland
Trades: 0
Quote:
Originally Posted by chrishirst View Post
with the id you don't need the named anchor. The ID can be used as the document fragment location.
Ah didnt know that!
stoot98 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Need to automatically scroll to div from URL
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13738 seconds with 12 queries