Struggling to find a solution to my simple problem. I want to create an animated button on my website that scrolls to a specific anchor point on the same page.
The code I currently have in Edge's code snippet box isn't working as expected. It's frustrating because it's unclear where exactly the code is being placed within the final result.
// add code for mouse click here
window.scrollTo(0,0);
//want it to scroll to #Main
Most of the code in Edge typically begins with:
sys.someAction()
If you're interested in seeing what I'm attempting to do, check out my site: www.daniellachman.com
Thanks!
Edit: Here is the complete code snippet along with the provided code below:
//Edge binding end
//CUSTOM CODE FROM Monty82
function scrollToTag(tagName) {
var myTag = $("a[name='"+ tagName +"']");
$('html,body').stop(false,false).animate({scrollTop: myTag.offset().top}, 'slow');
}
//Edge binding end
//Original Mouse Clicking Function Provided by Edge
Symbol.bindElementAction(compId, symbolName, "${_newlogoheader}", "click", function(sym, e) {
// insert code for mouse click here
//Stuff I added to call custom function above
sym.scrollToTag("main")
});
Despite my efforts, the solution didn't work, but I believe I'm making progress. www.daniellachman.com
If anyone has insights into examining the JavaScript for the menu navigation buttons like "about" and "contact" to determine how they trigger scrolling, please share your thoughts.