All scripts and files are stored in that team site (/sites/teamsite/SiteAssets/js or /sites/teamsite/SiteAssets/css).
I manage to get the tabs running fine by using a CEWP and referencing the JS file that loads all the scripts and css on the page. It runs fine and dandy. But a few times, when I refresh the page or navigate back to it, SharePoint for some reason starts trying to reference the files in the root site collection.
Nothing has changed in the CEWP, the original script file referenced in the CEWP is fine as well, that hasn't changed. No one else is working on the site (its still in dev). There is no other JS running on the page except the referenced in CEWP.
The weird thing is, it seems to work some times and not always. Which to me means there is something interfering with its execution but everything is out of the box so that doesn't make sense either. Any ideas would be appreciated!
EDIT: As soon as I posted this, I noticed something very peculiar. If I navigate to the url tenant.sharepoint.com/sites/teamsite, it doesnt work. But if I navigate to the url tenant.sharepoint.com/sites/teamsite/pages/default.aspx, it works!! WHAT