-
Notifications
You must be signed in to change notification settings - Fork 25.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom JavaScript #1504
Comments
Link to a public repo so I can debug or it didn't happen 😝 |
Also you may be having more of a "web development" and JavaScript issue which I can't really help much with. "And NOTHING happens" is extremely vague.
Sounds like you wrote some custom jQuery. And for that to work it needs to execute after jQuery has loaded.. which happens right before the closing You'll need to load your custom script after jQuery, so either squash it all together with the other scripts into a new If you add the array you'll need to include all of the scripts as using the array will override the use of
It's really up to you how you want to handle it. |
Apologies michael, my jquery works if I put a script block at the end of /_includes/scripts.html to load it, but I was trying not to customize the existing files and use the "approved solution". Unfortunately this is only on my local build at the moment (until I get it working properly. You can see the hacked version described above live at http://test.ab-tec.co.uk, repo is https://github.com/Andy-ABTec/minimal-mistakes. It's processing all the download links and the version number on the splash screen Thank you for the quick reply BTW... |
You have a typo in your scripts.html include. Missing a |
oops... Thanks, fixed that at least... |
And if you want to load your script without having the include see my notes above. You have to execute your scripts after jQuery loads or else it will fail. That's what happens when you tried to put it in the head. |
Right, I'll go try again, thanks for your time... |
Michael, you're a STAR,.. Thank you,! |
Hi again, sorry to be a pest, hopefully this will be the last time for a while...
BTW slugify worked like a charm for generating menu id tags, so many thanks for that
I've created a custom .js file containing my jQuery code in /assets/js/ which also works...
The problem I'm having is finding the best place to load the script.
https://mmistakes.github.io/minimal-mistakes/docs/javascript/ says: -
So I created a head_scripts array in _config .yml viz:
And NOTHING happens. The code needs to be available on every page including the splash and manual pages.
I've obviously done something silly like put the array in the wrong place - any help/advice gratefully received!
The text was updated successfully, but these errors were encountered: