I am trying to understand how reveal.js ( http://lab.hakim.se/reveal-js/#/ ) resizes elements dynamically.
To see this, adjust the height of the page and see how elements (to a certain degree) shrink as the page shrinks.
However, using chrome inspector, I cannot see how this shrinking is actually happening, either in CSS or Javascript.
(My interest comes from wanting to improve it, if possible, but I was surprised how hard it was to figure out how it works at all.)
If you look at the source code hosted on github https://github.com/hakimel/reveal.js/blob/master/js/reveal.js you can see exactly what it's doing.
It checks for browser CSS features like 2d and 3d transforms
It uses basic event listeners
The source code actually has decent commenting so you should be able to learn quite a bit.
Have you heard of media queries? This is a technique deployed through CSS that allows you to affect the styling of elements based on the width and height of the window. Here is how it's used for reveal.js https://github.com/hakimel/reveal.js/blob/master/css/reveal.css
Read On: MDN CSS Media Queries
Mini Tut: CSS Media Queries & Using Available Space | CSS-Tricks
Presentations are configured with a "normal" resolution, meaning the resolution the presentation was originally authored at. This is currently set to 960x700 by default.
Based on that resolution and the aspect ratio derived from it the framework will apply CSS 2D transforms to fit your content inside of any screen size. There are configuration values to control all of this including limits on how much the framework will ever scale your content.
Reveal.js also uses the
zoom
property to control the resizing of complete slide on small widths. It dynamically changes the value ofzoom
property which you can notice if you keep resizing the window.