codepen.io would be a good place to learn by example. You will see many isolated code samples with the clearly separated HTML/CSS/JS.
As you wrap your head around 'what is happening' as you put it, you can start to combine what you see to make new creations of your own.
For the basic timeline of when things happen, research how a website is rendered. Here's some info to get you started: http://frontendbabel.info/articles/webpage-rendering-101/