Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<style type="text/css">
/*<![CDATA[*/
.tst {
position:relative;overflow:hidden;width:200px;height:150px;border:solid black 1px;float:left;
}
.slide IMG{
position:absolute;left:0px;top:0px;width:200px;height:150px;
}
.frame {
position:relative;overflow:hidden;width:200px;height:150px;float:left;
}
.upbut {
position:absolute;display:none;width:200px;height:25px;left:0px;top:-500;background-Color:#6666FF;border-Top:solid black 1px;cursor:default;
opacity: .5;filter: alpha(opacity=50);-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
text-Align:center;color:#FFFFFF;
}
/*]]>*/
</style>
<script src="http://www.vicsjavascripts.org.uk/AnimatorBasic/AnimatorBasic.js" type="text/javascript">
// see http://www.vicsjavascripts.org.uk/AnimatorBasic/AnimatorBasic.htm
</script>
<script type="text/javascript">
/*<![CDATA[*/
// Slide Panels (04-May-2009)
// by: Vic Phillips http://www.vicsjavascripts.org.uk
// The script allows panels to be slid into or out of a parent element
// from the left, right, top or bottom by a mouseover, mouseout or click event of the parent element.
// This effect is useful in displaying text or slide show controls.
// The script is easily integrated with other applications.
// There may be as many applications on a page as required.
//
// The script utalises my 'Basic Animator' script.
// ****** Application Notes.
// **** The HTML and CSS Code.
//
// ** The Parent Element
// The parent element must have a style position of 'relative' or 'absolute', overflow of hidden,
// and the width and height specified with 'px' units.
//
// ** Each Panel
// Each panel must be nested in the parent div and assigned a class name.
// Each panel must have a style position of 'absolute' and the width and height specified with 'px' units.
// Each panel may have the style 'display' defined as 'none', this will be set to 'block' by the script.
// For 'left' and 'right' applications the panel left position will be controlled by the script.
// For 'top' and 'bottom' applications the panel top position will be controlled by the script.
//
// **** Initialisation.
//
// Each panel is initialised by a <BODY> or window event call to function:
// zxcSlidePanel('left','tst','left','click','click',1000);
// where:
// parameter 0 = mode of effect execution, 'left', 'right' 'top' or 'bottom'. (string)
// parameter 1 = the unique id name of the parent element. (string)
// parameter 2 = the class name of the panel. (string)
// parameter 3 = (optional)the event type to slide the panel in. (string, default = see Note 3)
// parameter 4 = (optional)the event type to slide the panel out. (string, default = see Note 3)
// parameter 5 = (optional) the duration of the effect in millSeconds. (digits, default = 1000 millSeconds)
// parameter 6 = (optional) 'sin' = effect starts fast, 'cos' = effect starts slow. (string, default = linear)
// parameter 7 = (optional) an array defining the start and finish positions of the panel. (array, default = see Note 1)
// field[0] = the start position in 'px'' (digits)
// field[1] = the finish position in 'px'' (digits)
//
// ** Note 1
// The default start and finish positions of the panel are:
// mode 'left' = start = - the panel width, finish 0.
// mode 'right' = start = the panel parent element width, finish - the panel width.
// mode 'top' = start = - the panel height, finish 0.
// mode 'bottom' = start = the panel parent element height, finish - the panel height.
//
// ** Note 2
// The default condition is the panels to be slid out and hidden on initilisation.
// See 'Controlling the Panel from a Link' if the panel is to be be slid in and visible.
//
// ** Note 3
// If the panel is ONLY to be controlled by event calls from objects other the the panel parent
// the 'in' event should be specified as false(see 'Controlling the Panel').
// If the 'in' event is specified as 'click' the 'out' event may be set to false.
//
// some notes removed to allow posting
// ****** Functional Code(3.11K) - N0 NEED to Change.
function zxcSlidePanel(mde,obj,cls,inn,out,ms,sc,srtfin){
obj=typeof(obj)=='string'?document.getElementById(obj):obj;
if (obj){
var panel=zxcSPClassName(cls,obj)[0];
if (panel){
var oop=new zxcSPOOP(mde,obj,panel,inn,out,ms,sc,srtfin);
return oop;
}
}
}
function zxcSPSlide(oop,ud,ms){
if (oop&&oop.slide){
if (typeof(ud)=='boolean') oop['slide'+(ud?'in':'out')](false,ms);
else oop.slideclick(false,ms);
}
}
function zxcSPOOP(mde,obj,panel,inn,out,ms,sc,srtfin){
this.obj=obj;
this.panel=panel;
this.sincos=sc&&sc.charAt?sc.toLowerCase():false;
this.ms=ms||1000;
mde=mde.charAt(0).toUpperCase();
this.mde=mde=='L'||mde=='R'?['left','width']:['top','height'];
this.mm=mde=='L'||mde=='T'?[0,-zxcSPWH(this.panel,this.mde[1])-5]:[zxcSPWH(this.obj,this.mde[1])-zxcSPWH(this.panel,this.mde[1]),zxcSPWH(this.obj,this.mde[1])+5];
if (srtfin) this.mm=srtfin;
this.panel.style.display='block';
this.oop=zxcBAnimator(this.mde[0],this.panel,this.mm[0],this.mm[1],10);
this.io=false;
if (inn=='click'){
this.addevt(this.obj,inn,'slideclick');
}
else if (inn){
this.addevt(this.obj,inn,'slidein');
if (out) this.addevt(this.obj,out,'slideout');
}
}
zxcSPOOP.prototype.slideclick=function(e,ms){
if (!e||this.ckevt(e,this.panel)) this.slide(this.mm[this.io?1:0],ms);
}
zxcSPOOP.prototype.slidein=function(e,ms){
if (!e||this.ckevt(e,this.obj)) this.slide(this.mm[0],ms);
}
zxcSPOOP.prototype.slideout=function(e,ms){
if (!e||this.ckevt(e,this.obj)) this.slide(this.mm[1],ms);
}
zxcSPOOP.prototype.slide=function(fin,ms){
ms=ms||this.ms;
this.oop.update([this.oop.data[0],fin],ms,this.mm,this.sincos);
this.io=!this.io;
this.panel.style.display='block';
}
zxcSPOOP.prototype.ckevt=function(e,p){
var eobj;
if (!e) var e=window.event;
e.cancelBubble=true;
if (e.stopPropagation) e.stopPropagation();
if (e.target) eobj=e.target;
else if (e.srcElement) eobj=e.srcElement;
if (eobj.nodeType==3) eobj=eobj.parentNode;
if (e.type!='click') eobj=(e.relatedTarget)?e.relatedTarget:(e.type=='mouseout')?e.toElement:e.fromElement;
if (!eobj||eobj==p||e.type=='click'&&eobj.zxc) return false;
while (eobj.parentNode){
if (eobj==p||e.type=='click'&&eobj.zxc) return false;
eobj=eobj.parentNode;
}
return true;
}
zxcSPOOP.prototype.addevt=function(o,t,f){
var oop=this;
if (o.addEventListener) o.addEventListener(t,function(e){ return oop[f](e);}, false);
else if (o.attachEvent) o.attachEvent('on'+t,function(e){ return oop[f](e); });
else {
var prev=o['on'+t];
if (prev) o['on'+t]=function(e){ prev(e); oop[f](e); };
else o['on'+t]=o[f];
}
}
function zxcSPClassName(nme,el,tag){
if (typeof(el)=='string') el=document.getElementById(el);
el=el||document;
for (var tag=tag||'*',reg=new RegExp('\\b'+nme+'\\b'),els=el.getElementsByTagName(tag),ary=[],z0=0; z0<els.length;z0++){
if(reg.test(els[z0].className)) ary.push(els[z0]);
}
return ary;
}
function zxcSPWH(obj,par){
if (obj.currentStyle) return parseInt(obj.currentStyle[par]);
return parseInt(document.defaultView.getComputedStyle(obj,null).getPropertyValue(par));
}
/*]]>*/
</script>
</head>
<body onload="zxcSlidePanel('bottom','tst7','upbut','mouseover','mouseout',1000,'',[0,-10]);zxcSlidePanel('bottom','tst8','upbut','mouseover','mouseout',1000,'',[130,140]);zxcSlidePanel('bottom','tst9','upbut','mouseover','mouseout',1000,'',[130,140]);" >
<div id="tst7" class="tst" >
<div class="slide" >
<div class="frame" ><img src="http://www.vicsjavascripts.org.uk/StdImages/Egypt6.jpg" /></div>
</div>
<div class="upbut" >
</div>
</div>
<div id="tst8" class="tst" >
<div class="slide" >
<div class="frame" ><img src="http://www.vicsjavascripts.org.uk/StdImages/Egypt6.jpg" /></div>
</div>
<div class="upbut" >
</div>
</div>
<div id="tst9" class="tst" >
<div class="slide" >
<div class="frame" ><img src="http://www.vicsjavascripts.org.uk/StdImages/Egypt6.jpg" /></div>
</div>
<div class="upbut" >
</div>
</div>
</body>
</html>
Bookmarks