Børre Stenseth
logo B. Stenseth

Slides fra webside

Hensikten er å lage en vevside som;

Basis

Løsningen er basert på følgende:

Dokumentstruktur

Vevsiden er organisert slik:

slide
header(fixed)
content(from section)
footer(fixed)
section
section
printfooter

Section

En section vi normalt bestå av:

Det er enkelt å utvide repetoiret av stilklasser for ulike medier.

Javascriptkode:

function slideShow(){
var isFullScreen=false;
var sections=document.getElementsByTagName('section');
var showElt=document.getElementById('slideContent');
var currentSlide=0;
document.onkeydown=checkKey;

showSlide(currentSlide);
changeStyle(isFullScreen);

function changeStyle(full){      
	if(full)
	{
		document.getElementById('projectionstyle').disabled=false;
		document.getElementById('screenstyle').disabled=true;
		document.getElementById('printstyle').disabled=true;
	}
	else
	{
		document.getElementById('projectionstyle').disabled=true;
		document.getElementById('screenstyle').disabled=false;
		document.getElementById('printstyle').disabled=false;
	}
}

function checkKey(evt) {
	var evt = (evt) ? evt : event
	var charCode = (evt.which) ? evt.which : evt.keyCode
	if(isFullScreen)
	{// filter legal keybd input, too strict ?		
	if( 
	  (charCode != 122)&&                     //f11
	  (charCode != 33) && (charCode != 34)&& //page up/dwn
	  (charCode != 38) && (charCode != 40)    //arrow up/dwn
	  )
	return false;
	}
	if (charCode == 122)  // F11
	{
		isFullScreen=!isFullScreen;
		changeStyle(isFullScreen);
		return true;
	}
	if (isFullScreen && 
		(charCode==33) && (currentSlide > 0)) 
	{//page up
		showSlide(currentSlide-1);
		return true;
	}
	if (isFullScreen && 
		(charCode==34)&&(currentSlide < sections.length-1)) 
	{//page down
		  showSlide(currentSlide+1);
		  return true;
	}
}

function showSlide(pix){
	showElt.innerHTML=sections[pix].innerHTML;
	currentSlide=pix;
}
}

Stilsett

Tre stilsett med id'er screenstyle, printstyle og projectionstyle må være på plass

Minimalistiske løsninger

Screen

@media screen
{
  #projection{display:none;}
  .printFooter{ display:none;}
  section,.print-and-screen{display:block;}
  p,li{font-size:11px; color:black;}
  .codebox{width:100%;overflow: auto;max-height: 30em;}
}

Print

@media print
{
  h2{page-break-before:always;font-size:36px;}
  p{font-size:12px;color:black;}  
  #projection{display:none;}
  .codebox{width:100%;overflow: auto;max-height: 300em;}
  section,.print-and-screen{display:block;}
  .printFooter{ display:block ;font-size:11px;color:blue;
       position:fixed;right:5px;bottom:10px	
  }
}

Projection

body{
  margin-left:30px;margin-top:10px;margin-right:30px;
  padding-left:100px;padding-right:100px;padding-top:10px;
  font-size:24px;
}
.printFooter{ display:none;}
#projection{ display:block;}
#projection footer{font-size:11px; color:gray;
       position:fixed;bottom:10px;width:100%;
}
#projection header{color:gray;width:100%;
       padding-top:10px; padding-left:10px; margin-bottom:40px;
}
section,.print-and-screen{display:none;}
.codebox{width:100%;overflow: auto;max-height: 30em;font-size:20px}
li{font-size:24px;margin:10px}
h1,h2{ page-break-before:always; font-size:36px;
}

Navigering

Innhold på en slide

En slide kan innehold all lovlig HTML5, bortsett fra section.

Video

(Eksempel fra W3Schools)

video

Canvas