Thanks very much Alan.
I have now decided I don’t need that particular bit of javascript in any other pages apart from the home.php
So rather than place it right in the footer I have moved it to the bottom of home.php
That’s not ideal for the home page – though it’s better – but it does mean the other pages load much faster as they don’t even call the js from the footer.