js源码slide.js:
// JavaScript Document
/**
* @function slide向一边显示块
* @direction objId显示块的id,direction方向,speed速度
*/
function slide(objId, direction, speed, destorySign){
var effect = this;
var obj = null;
var top = 0;
var bottom = 0;
var left = 0;
var right = 0;
var container = null;
var direction = direction;
var speed = speed ? speed : 20;
var timer = null;
var destorySign = destorySign ? destorySign : false;
var init = function(){
obj = document.getElementById(objId);
obj.style.position= "absolute";
obj.style.display = "block";
top = obj.offsetTop;
left = obj.offsetLeft;
var parent = obj.parentNode;
container = document.createElement("div");
container.style.overflow = "hidden";
container.style.position = "absolute";
container.style.zIndex = 1000;
container.appendChild(obj);
parent.appendChild(container);
if(parent.tagName != "BODY"){
container.style.width = obj.offsetWidth + "px";
container.style.height = obj.offsetHeight + "px";
container.style.top = top+"px";
container.style.left = left+"px";
top = 0;
left = 0;
}
else{
container.style.width = "100%";
container.style.height = "100%";
container.style.top = "0px";
container.style.left = "0px";
}