Using SharePoint 2010:
I am trying to jump to a specific section on my page, but I need to do it after the document.ready has completed. When I click from page 1, information is added to the end of the URL depending on which button is pushed. When I arrive at page 2, the URL ends in something like this .aspx?Org=Exec.
I have a variable on page 2 that pulls that "Exec" out and now I want to run an if statement that says "If the variable == Exec then jump to the div with the id of "exec" on this page"
I have no idea where to even start with this to get it to work, so I don't have much sample code to provide. I must stress that I need this to occur after the page has finished loading. Normal HTML anchors wouldn't work for this situation.
So, this is what will be clicked from page 1:
<div onclick="location.href='https://websitename/SitePages/ContactUs.aspx?Org=Exec'">Executive Administration</div>
Then when we arrive on page 2, we have this inside document ready:
var anchor = window.location.href.split('?Org=')[1];
if(anchor == 'Exec'){
insert some way to jump to div id="exec"
}
so what the heck do I put in the if statment to make it move straight to the anchor?
Please let me know if I need to provide additional information.
0 commentaires:
Enregistrer un commentaire