jQuery(document).ready(function($){
const container = document.querySelector('.takeout-nav');
let containerRect = container.getBoundingClientRect();
const activeOption = document.querySelector('.current-menu-item');
let activeOptionRect = activeOption.getBoundingClientRect();
if (containerRect.left + containerRect.width < activeOptionRect.left + activeOptionRect.width){
container.scrollLeft += activeOptionRect.left - containerRect.left;
}
else if (activeOptionRect.left < containerRect.left){
container.scrollLeft -= containerRect.left - activeOptionRect.left;
}
});