I managed to get them to work to slide up, but then when I put the code in to slide back down again it started spazzing out!
Can anyone help at all? Here's my javascript code.
- Code: Select all
<script type="text/javascript">
var curVisible;
var oldObject;
var pusher;
var pushBack;
var inMotion = false;
function reveal(obj) {
if(curVisible != null) {
oldObject = curVisible;
}
if(!inMotion) {
curVisible = obj;
pusher = -100;
pushBack = 40;
document.getElementById(obj).style.visibility = "visible";
document.getElementById(obj).style.bottom = pusher+"px";
animateOut();
animateIn();
}
}
function hide() {
animateIn();
}
function animateIn() {
if (pushBack > -100) {
inMotion = true;
pushBack -=4;
document.getElementById(oldObject).style.bottom = pushBack+"px";
setTimeout(animateIn, 20);
} else {
document.getElementById(oldObject).style.visibility = "hidden";
inMotion = false;
}
}
function animateOut() {
if(pusher < 40) {
inMotion = true;
pusher += 4;
document.getElementById(curVisible).style.bottom = pusher+"px";
setTimeout(animateOut, 20);
} else {
inMotion = false;
}
}
</script>
Thanks very much. Have tried loads, but just can't seem to get it to work. It's a lot more complicated than I first thought.
Dave


