Jump to content
  • 0

Плавно выпадающая панель


YISHIMITSY
 Share

Question

вобщем такое дело, люди... я в Джаваскрипт ваще не шарю, так что кому не лень, пожалуйста помогите мне с этой фигнёй. тут приведён код плавно выпадающей панели при нажатии на кнопку такого плана:

<input class="buttons" type="button" value="Выпадалка"></input>

А мне нужно переделать нижеприведённый javascript код для простой ссылки. Вот сам этот код:

var arry=[];

window.onload = function () {
var nodes = document.getElementsByTagName('div');
var length = nodes.length;
for(var z = 0;z < length; z++){
if(nodes[z].className == 'out') {
var cnl=nodes[z].childNodes.length;
for(var i = 0; i < cnl; i++) {
if (nodes[z].childNodes[i].className == 'buttons') {
arry[z] = new construct(nodes[z].childNodes[i]).init();
}
}
}
}
}

function construct(node){
this.node=node;
}

construct.prototype = {
init: function() {
var _this = this;
if(this.node.addEventListener) this.node.addEventListener('click', function() { _this.caller.call(_this); }, false);
/*@cc_on
var _this = this;
this.node.attachEvent('onclick', function() { _this.caller.call(_this); });
@*/
this.step=this.node.offsetHeight;
this.outdiv=this.node.parentNode;
this.indiv=this.outdiv.getElementsByTagName("div")[0];
this.flag=0;
},
caller: function() {
var t=this;
var oh=parseInt(t.outdiv.offsetHeight);
var ih=parseInt(t.indiv.offsetHeight);
if(t.flag==0){var i = t.step;
function animatoru() {
t.outdiv.style.height=i+"px"
if(i > ih) clearInterval(timeru);
i+=t.step;
}
timeru = setInterval(animatoru,1);
t.flag=1;
}
else {var i = oh;
function animatord() {
t.outdiv.style.height=i+"px"
if(i == t.step) clearInterval(timerd);
i-=t.step;
}
timerd = setInterval(animatord,1);
t.flag=0;
}
}
}

Помогите плиз. Зарание спасибо!

Edited by YISHIMITSY
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy