Login   Register  
PHP Classes
elePHPant
Icontem

File: js/photoalbum.js

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Andy Loftus  >  Photo Album  >  js/photoalbum.js  >  Download  
File: js/photoalbum.js
Role: Auxiliary data
Content type: text/plain
Description: Javascript to initialize moo.fx objects
Class: Photo Album
Display interactive photo album
Author: By
Last change: Add Accessible without user login
Date: 7 years ago
Size: 713 bytes
 

Contents

Class file image Download
//the main function, call to the effect object
function init(){
	var stretchers = document.getElementsByClassName('stretcher'); //div that stretches
	var toggles = document.getElementsByClassName('tab'); //h3s where I click on

	//accordion effect
	var myAccordion = new fx.Accordion(
		toggles, stretchers, {opacity: true, height: true, duration: 400}
	);

	//hash functions
	var found = false;
	toggles.each(function(h3, i){
		var div = Element.find(h3, 'nextSibling'); //element.find is located in prototype.lite
		if (window.location.href.indexOf(h3.title) > 0) {
			myAccordion.showThisHideOpen(div);
			found = true;
		}
	});
	if (!found) myAccordion.showThisHideOpen(stretchers[0]);
}