8-bit fluff Title:Jon-Keatley.com


Slide ShowSlide ShowSlide show is a piece of JavaScript that attaches to a set tag id and takes in all the children elements of a set tag and converts them into an interactive slide show. This basically means if JavaScript is disabled or unavailable the content will still be viewable. This example was inspired by a similar system found on Socrates SystemCategory: WebsiteMain Language Used: JavaScript / AJAXSupport Languages Used: CSSHTML / XHTMLClick to view

Coding Samplevar load = function() { //find target var target = document.getElementById(targetId); if(target != undefined) { //strip out elements var tmp = target.getElementsByTagName(targetType); for(x=0;x<tmp.length;x++) { elements.push(tmp[x].cloneNode(true)); } while(target.hasChildNodes()) { target.removeChild(target.firstChild); } //replace class target.setAttribute("class",targetWrapperClass); //add new elements displayDiv = document.createElement("div"); displayDiv.appendChild(elements[0].cloneNode(true)); displayDiv.setAttribute("class",displayClass); target.appendChild(displayDiv); animationDiv = document.createElement("div"); animationDiv.setAttribute("class",animationClass); controlPanel = document.createElement("div"); controlPanel.setAttribute("class",controlClass); //add max controls limit for(x = 0;x < elements.length;x++) { var tmp = document.createElement("a"); if(currentElement == x) { tmp.setAttribute("class",selectedClass); } else { tmp.setAttribute("class",optionClass); } tmp.setAttribute("href","#"); tmp.setAttribute("joncore_slide",x); tmp.id="lnk" + x; tmp.onclick = click; controlPanel.appendChild(tmp); } target.appendChild(controlPanel); target.appendChild(animationDiv); } else { alert("Target Id [" + targetId + "] not found!"); } }