I make some tweaks to make it fit for your requirement
$("#example-one li").find("a").hover(function() {
$el = $(this);
var padding = ($el.outerWidth() - $el.width()) / 2;
console.log($el.outerWidth(),$el.width(), padding)
leftPos = $el.position().left + padding;
newWidth = $el.width();
$magicLine.stop().animate({
left: leftPos,
width: newWidth
});
}, function() {
$magicLine.stop().animate({
left: $magicLine.data("origLeft"),
width: $magicLine.data("origWidth")
});
});
Also need to change the current_page_item
also
var $currentItem = $(".current_page_item a");
var padding = ($currentItem.outerWidth() - $currentItem.width()) / 2;
$magicLine
.width($currentItem.width())
.css("left", $currentItem.position().left + padding)
.data("origLeft", $magicLine.position().left )
.data("origWidth", $magicLine.width());
Demo: Fiddle