How can I replicate this function in a different container?
function goto(id, t){
// Move to the designated div id using animation
$(".headbox-wrapper").animate({"left": -($(id).position().left)}, 600);
// Remove the "active" class from all links within #nav
$('#nav a').removeClass('active');
// Add the active class to the current link
$(t).addClass('active');
}
Create a new function with a different name and apply it to a new container, for example function2.
The new function will be placed on the same page as this one. Simply copying and pasting the script won't make them work independently, as it seems quite obvious.