updated js to check for toggle elements and moved init to page bottom