4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 PLEASE someone help me with this code...
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
hratch
Junior WebHelper
Junior WebHelper


Joined: 13 Sep 2003
Posts: 1
Location: Lebanon

PostPosted: Sat Sep 13, 2003 3:42 pm (14 years, 2 months ago) Reply with QuoteBack to Top

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);
}
}
OfflineView User's ProfileFind all posts by hratchSend Personal MessageMSN Messenger
adam
Forum Moderator & Developer



Joined: 26 Jul 2002
Posts: 704
Location: UK

PostPosted: Sun Sep 14, 2003 10:47 am (14 years, 2 months ago) Reply with QuoteBack to Top

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...
OfflineView User's ProfileFind all posts by adamSend Personal MessageVisit Poster's Website
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Sun Sep 14, 2003 11:26 am (14 years, 2 months ago) Reply with QuoteBack to Top

Actually, I think you do Razz

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

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
adam
Forum Moderator & Developer



Joined: 26 Jul 2002
Posts: 704
Location: UK

PostPosted: Sun Sep 14, 2003 2:23 pm (14 years, 2 months ago) Reply with QuoteBack to Top

lol, whatever, it was just a random idea Razz

________________________________
It's turtles all the way down...
OfflineView User's ProfileFind all posts by adamSend Personal MessageVisit Poster's Website
jedioutcaster
Junior WebHelper
Junior WebHelper


Joined: 23 Dec 2003
Posts: 4

PostPosted: Tue Jan 06, 2004 6:33 am (13 years, 10 months ago) Reply with QuoteBack to Top

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.
OfflineView User's ProfileFind all posts by jedioutcasterSend Personal Message
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




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.057185 seconds :: 17 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme