I am having this issue with one of my sites as well. Since I have a 404 redirect plugin enabled (and even renaming the plugin folder doesn’t disable it), it just puts me into a redirect loop when I try to access the main site’s login page. I am able to sign in with a subdomain site, but not able to access the main site or the network site.
I just ran into this issue as well. This code goes in the theme on the scripts.php file. If you add it to the script that is there, or go back to the sample website and copy the entire script, the only thing you need to replace are all the $(…) with jQuery(…). WordPress doesn’t allow the shortcut of using $ instead of jQuery. This should solve you problem because I just got it to work on the website I just built.