|
Author |
Message |
hratch
Junior WebHelper
Joined: 13 Sep 2003
Posts: 1
Location: Lebanon
|
Posted:
Sat Sep 13, 2003 3:42 pm (21 years, 4 months ago) |
|
i want to do the following:
when one presses on a certain cell (link), i want that a previously hidden layer slowly comes down from the link (which will contain the details of the link). For example, when pressing on "BAND MEMBERS", i want that slowly a table (actually a layer) comes down below it containg "MARK", "THOMAS", "JACK"...
i used the following recursive function using setTimeout() to time the coming down of the hidden layer, but it's not working Maybe i'm using setTimeout wrong!! CAN SOMEONE HELP ME. OR MAYBE GIVE ME A WHOLE NEW IDEA OF HOW TO DO IT??
...(CurrentLayer is the layer which is hidden before the function is called.)
//global variables;
var i = new number(0);
function ShowLayer(CurrentLayer)
{
L = document.getElementById(CurrentLayer);
L.style.height = i + "px";
L.style.visibility = "visible";
if (i < 100)
{ i += 5;
setTimeout("ShowLayer(CurrentLayer)", 15);
}
} |
|
|
|
|
adam
Forum Moderator & Developer
Joined: 26 Jul 2002
Posts: 704
Location: UK
|
Posted:
Sun Sep 14, 2003 10:47 am (21 years, 4 months ago) |
|
I'm not totally sure, but I don't think you need to add the "px" on the end of the height... |
________________________________ It's turtles all the way down... |
|
|
|
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Sun Sep 14, 2003 11:26 am (21 years, 4 months ago) |
|
Actually, I think you do
Code: | style="height: 15px" | is correct, so why not have the "px" on the end in JS?
However I can't be of any help for the rest of the code - JS is not my thing |
________________________________
|
|
|
|
adam
Forum Moderator & Developer
Joined: 26 Jul 2002
Posts: 704
Location: UK
|
Posted:
Sun Sep 14, 2003 2:23 pm (21 years, 4 months ago) |
|
lol, whatever, it was just a random idea |
________________________________ It's turtles all the way down... |
|
|
|
jedioutcaster
Junior WebHelper
Joined: 23 Dec 2003
Posts: 4
|
Posted:
Tue Jan 06, 2004 6:33 am (21 years ago) |
|
Try using "clip". "height" will not work properly since browsers interfere with the normal flow of the object's size. Instead, "clip" might give you a whole new idea. Same to you, hratch (if I can call you like that), I was having lots of trouble trying to make something like that. I was programming a hover menu with fading and inserting fx.
Each time the setTimeout loops, have the "clip" possess a different value.
Example:
(not gonna include <TABLE> tags) I have a cell here:
<td onmouseover="drop()">BAND MEMBERS</td>
And here's the cell I want to add the effect to:
<td style="position: absolute; visibility: hidden; clip: rect(auto auto auto auto)">
MARK<br>
THOMAS<br>
JACK<br>
</td>
In the scripting part:
<script language=jscript>
//global variables
var i = 0
function ShowLayer() {
var mouseoverobj = event.srcElement //retrieve the first block
mouseoverobj.nextSibling.style.clip = "rect(auto "+factor+"% auto auto)"
if(i < 100) {
i += 5
setTimeout("ShowLayer()", 5)
} else {
mouseoverobj.nextSibling.style.clip = "rect(auto auto auto auto)"
// in case you want to make sure it is 100% visible and not 97% or something.
factor = 0 // clears the factor for use next time
}
}
</script>
If you want to know how to make a fading menu, tell me. |
|
|
|
|
|
|
You cannot post new topics in this forum. You cannot reply to topics in this forum. You cannot edit your posts in this forum. You cannot delete your posts in this forum. You cannot vote in polls in this forum.
|
Page generation time: 0.138665 seconds :: 17 queries executed :: All Times are GMT
Powered by phpBB 2.0
© 2001, 2002 phpBB Group :: Based on an FI Theme
| |