"Powerpoint-ify" a page
JavaScript demo of hiding and showing parts of a page.
Display/hide parts of a page (div's) one by one.
Exercise - Get "Powerpoint-ify" working on your site
- Copy the Minimal powerpoint demo.
- Make sure the link to the JS works.
- Add some div's with some real content.
- Number your divs.
- Test it works.
Exercise - Write a more flexible "Powerpoint-ify"
- Don't have to number the div's. Just mark them:
<div class=pp>
- Make your own copy of the JS library and edit it.
- Don't need MAX.
- JS finds all div's of that class using:
var a = document.getElementsByClassName("pp"); // array
for ( var i = 0; i < a.length; i++ )
// if i is current page then show a[i]
// else hide a[i]
Q. Why not just search for any divs? Why use a class?