- This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › Where does the HTML link to the JS file?
Hi,
I have a decent bit of experience with basic HTML/CSS websites but am trying to learn more about js.
I was looking at this page on codepen and couldn’t figure out where in the HTML, the js is called in.
Can anyone help?
Cheers,
Marc
It might not be.
In Codepen, if you write the raw JS in the JS box it just runs automatically when required or immediately, if it’s supposed to run on page load.
If you inspect the DOM of the iframe, you can see where the JS is in the page if that’s what you’re wondering.
If you need information on how to link example.js
file in your HTML. Take a look at html5boilerplate index page. If you are confused about anything in that file, let us know.
I was looking…on codepen and couldn’t figure out where in the HTML, the js is called in.
CodePen is a sophisticated system that lets you type in code and preview it live. What you enter in those 3 boxes is essentially taken into the system and injected into the preview. If you inspect the preview you’ll see styles and scripts. In the example pen you linked to, all the code is actually in the JS box. Nothing extra is linked up. You can see this by clicking on the little gear circle for settings. Each box has it’s own (HTML, CSS, JS). Now the code is just minified version of modernizr.com, which is a feature detection tool. Non of the animations are actually running from this JS file.
I’ve forked a version without JS here. If you look at the settings again, you’ll see Modernizr checked off, and that’s it. All animation is CSS.