But to answer your original question, Anchors* are a nickname for a “fragment URL” (thats my made-up term for the thing, nothing official). Most URLs refer to a page (or a folder, which is actually the same thing under the hood). When you tack a #someID to the end of that URL, it extends the URL to refer to a specific element within the page.
All browsers have the following behavior when they follow such a URL: if the element is found in the page, then the window will scroll until that element is visible (if necessary), and if the element is not found, then the window will scroll to the top. That’s why you will see the window snap to the top if you click a URL that contains just a # at the end.
Often, especially in a very tall page, or a page with many important sub-topics, anchors are used for in-page navigation, zipping you from one spot to another within the same page. (See “back to top” links almost anywhere, for example.) Technically, these in-page links take the form of just #someFragmentName
in the HTML, but the browser always expands a URL based on the current page’s base URL, so it really means http://example.com/some-page.html#someFragmentName
once that expansion takes place. The browser just realizes that the link is to the same page, so it doesn’t refresh the entire window before zipping to that spot.
Another use for this technique is to actually link to a portion of a tall page from another page. In this case, the browser will load the tall page (since it’s not the current page) and then zip down to the fragment specified in the anchor.
Many of the Freeway templates use the CSS Menu Action, and that Action has the following behavior – if an option within the menu is not linked to any page, then a fake link to # will be added to it so the styling works out and the menu looks correct. This will cause the browser to snap back to the top of the page, since the anchor is not valid. It is popular to use # or #top (where there is no actual element with the ID top
on the page) to get the back-to-top behavior to happen. It is popular, but invalid and a bad idea. Better technique is to find the ID of an element that exists at or near the top, and anchor up to that actual element instead. If your navigation bar is at the top of the screen, then linking to #yourNavBarId instead is correct and semantic.
Walter
*Technically, any hyperlink is an anchor – that’s what the ‘a’ in <a href="whatever">
stands for.
On Jun 10, 2014, at 5:38 AM, Iain Mackenzie wrote:
Sorry, I think I have solved my problem. Didn’t notice that the Smoothscroll action was out of date, so I updated to the latest version and that now works.
Also, l didn’t notice the ‘Fixed in Windows’ option in Layers, so now I have the nav bar always on top.
All’s well that ends well.
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options