Jump To Anchor Tag Onload?

Aug 11, 2009

I currently have a script to jump to an anchor tag when the page loads:

<script type="text/javascript">
function goToAnchor() {
location.href = "myPage.html#myAnchor";
}
</script>

Now, I would like to take it a step further and would like to link from page A to page B that usually takes a while to load and once the page loads, run a script to jump to the specified anchor tag on the page after everything has loaded. I know I have to add some parameters at the end of the url link on page A, but that's where I get stuck.

View 6 Replies


ADVERTISEMENT

Script-Added Anchor Preventing Jump Of Doc-Coded Anchor?

Jan 9, 2010

I have a script that scans an HTML document for headers and special comment tags for the purpose of generating a left-floating/position-fixed DIV that contains the document's outline or "table of contents." Within the DIV are lists (UL element by default) whose items (LI elements) are jump-to links (A elements) to the points (headers, special points marked for inclusion in table of contents) in the document. The problem is this. I have typical HTML document with links that jump to points (usually headers) inside the document, as shown below:

Code:

<body>
<p>This is addressed <a href="#later-text">later</a> in this document
<h1><a id="later-text"></a>Header Text</h1>
<p>...
</body>

But my script, being a document outliner that finds headers in a document, inserts another anchor as a jump-to point just before the first occurrence of text in the header (inserted A element shown in red below). This somehow disables the document-coded jump anchor (shown in blue below). And it occurs in FF and IE, which suggests it is not a browser-specific issue. Why does it occur? Is there something in the HTML spec that states that two anchors to which a jump occurs are not allowed to be adjacent elements in the document?

Code:

<body>
<p>This is addressed <a href="#later-text">later</a> in this document
<h1><a id="later-text"></a><a id="jump-1"></a>Header Text</h1>

[code]....

To reproduce what I am seeing, search for the text "Why Is A Survey Done". The first occurrence is a within-document jump-to link, which should jump to a header below it. If the script execution to generate a document outline is disabled, the jump works. But if the script is executed and the document outline generated, the jump-to link does not work.

View 2 Replies View Related

JQuery :: Hidden IFrame Does Not Jump To Anchor In FF?

Sep 28, 2010

I have a hidden iFrame (display:none) which I change the src attribute of to load new contents. When the iFrame has finished loading I make it visible again (display:inline). This works fine except for anchors. The iFrame will not jump to an anchor when finished loading if its hidden in FF.

View 2 Replies View Related

JQuery :: Jump To Anchor Tag On Page Load?

Jan 27, 2011

Have a drupal site and jquery update1.3. seems to avoid the posiblity to jump to anchor tags. In order to this I use this script for jumping on a page. I works..But how to I manage a jump, if the href is on a different page (not external!).Something like jump on pageload to an anchor.click on page node/5/products on link href: node/5/products/xyz/#anchor1 How do I manage this?

$(document).ready(function(){
$a[href*=#]").click(function(e){
$

[code]....

View 2 Replies View Related

JQuery :: Preventing Anchor Jump To #test1 Automatically?

Mar 26, 2010

You know how when you visit [URL] your browser jumps to #test1 automatically? Not talking about when you open page.html and THEN click an anchor to #test1. I mean typing the anchor explicitly at the end of the url before even visiting page.html. How do you prevent that jump? Just a sample scenario, to make sure I'm being extra clear:

[Code]./..

View 2 Replies View Related

Make The Focus Jump To The Next Element (anchor) In A Page?

Jun 4, 2009

vBulletin uses a template system so I can't create a separate element for everything -- we have had several people ask for a "skip to the next post" feature and I'd like to implement that for them My first thought was to use anchor tags such as:

<a name="$post[postid]">

for each post and then to create a link for "Jump to Next Post" which would advance the user to the next instance of <a name="$post[postid]"> in which the postid obviously would've changed. With that I didn't know if there was a way that I could have javascript look for the next instance of this, or to pull the postid number and add 1 to it to find the next post on the page. I'm also not sure if it would need to be as complicated as reading where it was at and then adding one and directing person to that anchor point, which is why I thought maybe it could just look for the next instance of <a name="$post[postid]"> and refocus the screen on that.

It doesn't have to be an anchor, it can be a hidden input, whatever makes the JS be able to seek it as a point to move the page to. We do have some members that select a different number of posts per page than the default, so I'm guessing that the plus one might not be a great idea if they used a smaller number per page and then clicked the last one, whereas people with more per post wouldn't need to stop at the same point before it no longer let them. If there's a solution for that, that'd be great as well (such as once it hits the last element on the page, it no longer receives instruction, goes to the top of the page, or something).

View 2 Replies View Related

Anchor Point - Click Link To Jump To Another Page?

Jun 17, 2011

When you click a link it jumps to an anchor point on the page and scrolls there smoothly. I was wondering how I get the same effect if I want the link to jump to another page? A normal anchor point on another page would set the href to, for instance, 'index.html#contact' but it won't work in this case as the javascript isn't reading the '#'.
<script type="text/javascript" src="jquery.js"></script>
<script>
function goToByScroll(id){
$('html,body').animate({scrollTop: $("#"+id).offset().top},'slow');
}
</script>
</head>
<body>
<ul>
<li><a href="javascript:void(0)" onClick="goToByScroll('contact')">Go to anchor 1</a></li>
</ul>

View 13 Replies View Related

Stop Jump To Anchor Links On Page Refresh?

Jun 22, 2010

I've used the ScrollTo plugin for header images for each topic and I have created a menu to change the content in the div(s) that contain readable content with ajax, so it looks like different pages with headers using the one page.

everything works well, but on browser refresh the page jumps down after the menu and on to the header.

Would anyone know a script that would deactivate all anchor links in the page so that page onload the page loads as default index.html instead of index.html#some_anchor

View 7 Replies View Related

Universal To Get Anchor Param In The Url And Jump To That Spot On The Page

Aug 14, 2009

using js to force a specific anchor call to jump after the page completely loads. The reason I am doing this is because the page I am linking to with anchors takes a long time to load and a standard browser anchor link sometimes does not work 100%. With that said, I would now like to make the script I wrote universal to get ANY anchor param in the url and jump to that spot on the page. Right now it's coded to just look for "#anchor". I want to re-code it so it will look for "#" + "anyAnchorName".

[Code].....

View 1 Replies View Related

Anchor Specific OnLoad Run Function?

Aug 18, 2010

But I was wondering is it possible to make it so that if you visited an anchor link: For example, let's say you visit:

Code:

[URL]

Then a code would run to let's just say... change the color scheme of the website. (And theoretically they same would happen with #v2/#v3, ect)

But the code would NOT run if the requested URL is just

Code:

[URL]

The reason I was wondering is I want the user to be able to "bookmark" a certain script per-say, so that when they revisit the site they don't have to reclick things to get back to where they were before.

View 7 Replies View Related

Catch #anchor Link OnLoad?

Aug 31, 2010

What I want is for jQuery to do something when the page has loaded depending on the anchor in the URL.

For example:

domain.com/index.html#dothis
domain.com/index.html#dothat
domain.com/index.html#dosomethingelse

Do these come under the onLoad event or something else?

View 1 Replies View Related

Catch Page Anchor Without Onload?

Dec 27, 2010

how would I go about capturing the page anchor in the address bar without the onload function and without page refresh?

View 1 Replies View Related

JQuery :: Reload Page With Anchor When Anchor Link Is Clicked?

May 26, 2011

I need to get the page to reload with the anchor in the link when it is clicked in a dropdown menu. For example if I am on 'www.domain.com/about/#2' and I then click on 'www.domain.com/about/#3' the url changes but the page doesn't reload so I need the page to reload, but keep the new anchor (#3).I gave the links with anchors a class of 'reload' and tried this:

$('a.reload').click(function() {
window.location.reload();
});

View 4 Replies View Related

Using Anchor Jumps With 'instant' Anchor Based Navigation?

Sep 4, 2011

Having a little bit of trouble with a site I'm currently working on I'm using some AJAX for the instant g-mail/facebook style navigation, you know the kind, with no refreshes, etc. Problem is, to allow for back/forward and bookmarks, I currently use a URL that looks like:[URL].. This is fine, not a problem... The issue comes into play when I want to open up the news.html page, from my home.html page, and have it open to news item #6 (for example).

I can't add a #, because one is already being used to reference the anchor for the content div. Has anyone run into a similar problem before? If so, how did you resolve it? Can some jQuery be used to find the location of the news item div in question, on load, and scroll to it like that?

View 8 Replies View Related

Frameset Onload Event Get Called When Each Of The Frames Has An Onload?

Jul 23, 2005

I'm having a hard time figuring out why the onload event is not being
called for the frameset window in the following simple example. It is
being called for each of the component frames. Code:

View 5 Replies View Related

Which Loads Faster, Body Onload Or Window.onload

Dec 3, 2005

I wander what gets loaded the fastest (1-2 or 3) in what succession:

<head>
<script type="text/javascript">
function andAction() {
// doing stuff
}
</script>
</head>

<body onload="andAction();">
<script type="text/javascript">andAction()</script></body>

just in the head and nothing more

This I am sure off:

<head>
<script type="text/javascript">
window.onload = function andAction() {
// doing stuff
}
</script>
</head>
<script type="text/javascript">andAction()</script></body>

just in the head and nothing more (should be 1)

Third and last which is faster:

body onload or window.onload

View 3 Replies View Related

Window.onload And Body.onload Differences

Jul 23, 2005

I'm seeing a difference in behaviour between

window.onload = f();

and

<body onload="f();">

Specifically, window.onload appears to fire before all the elements of
the page have been rendered. As the difference is consistent across
IE/Moz/Opera, I'm assuming it's deliberate - can anyone point me
towards where this behaviour of window.onload is defined in the
documentation? TIA. Code:

View 2 Replies View Related

Jump To The Content

Oct 6, 2006

I was just wondering if there is a jscript code to jump to the middle (or where my content is) of the page if i click on the link on the same page. if not how would you do it anyways?

View 4 Replies View Related

Eliminate Jump To Top?

Feb 3, 2011

On my site I have a switch and JQuery fade in fade out when I click on 'Updates' or 'Projects'. Problem is that if I have scrolled down the page a little before clicking one of them, the page jumps back to top on clicking these options. I would like to eliminate that jump to the top.

[URL]

View 11 Replies View Related

Automatic Jump

Jul 20, 2005

I need to find the code that makes a web page immediately jump over to another url the moment a visitor arrives to it. I know the code is short, but I can't remember it. Anybody know what that code is?

View 3 Replies View Related

Jump-menu In IE

Mar 23, 2007

I have created a small javascript jump menu that is designed to hide/display content depending on the users selection. It works perfectly in firefox, but nothing happens in IE. Code:

View 3 Replies View Related

Using A Form To Jump To URL?

May 19, 2010

I'm trying to get my form to jump to the necessary URL. The form is mixed with PHP, HTML and has some JS and AJax in there as well.In its simplest form - This is all in a while loop INDEX.PHP

[code]...

View 1 Replies View Related

Page Jump On MoveRow?

Mar 25, 2011

I have this (nice) procedure to move a table row:

Code:
function MoveRow(tbl,i,j) {
tbl = document.getElementById(tbl);

[code].....

View 5 Replies View Related

Jump Menu Query

Aug 21, 2007

I have this code which works well, but rather than buttons (title 1, title 2), I want to achieve the same description change using a jump menu. I'm pulling my hair out trying to work it out and i'm sure it's simple. Code:

View 3 Replies View Related

Jump To Search Terms

Aug 31, 2007

Is there anyway to use Javascript (or other code) so that if you've arrived at a web page on your site via google (and there is alot of text on the screen) the javascript will scroll automatically to the searched terms?Is there anyway to use Javascript (or other code) so that if you've arrived at a web page on your site via google (and there is alot of text on the screen) the javascript will scroll automatically to the searched terms?

View 1 Replies View Related

Dropdown Jump List In IE ?

Jun 18, 2010

I am using the folloeing dropdown list code on my site and have found that it doesnt work properly in IE. Sometimes it works.... Sometimes it doesnt 'jump to page'

PHP Code:

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved