Dr. Mark Humphrys

School of Computing. Dublin City University.

Online coding site: Ancient Brain

coders   JavaScript worlds

Search:

Free AI exercises


"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

  1. Copy the Minimal powerpoint demo.
  2. Make sure the link to the JS works.
  3. Add some div's with some real content.
  4. Number your divs.
  5. Test it works.
  

Exercise - Write a more flexible "Powerpoint-ify"

  1. Don't have to number the div's. Just mark them:
    <div class=pp>
  2. Make your own copy of the JS library and edit it.
  3. Don't need MAX.
  4. 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?
  

ancientbrain.com      w2mind.org      humphrysfamilytree.com

On the Internet since 1987.      New 250 G VPS server.

Note: Links on this site to user-generated content like Wikipedia are highlighted in red as possibly unreliable. My view is that such links are highly useful but flawed.