The easy solution is to set a global flag so that it only runs once:
var pageInitialized = false;
$(function()
{
if(pageInitialized) return;
pageInitialized = true;
// Put your init logic here.
});
It’s sort of hack-ish, but it works.
Reference: https://stackoverflow.com/questions/10727002/jquery-document-ready-fires-twice
Thanks to https://stackoverflow.com/users/334053/qjake