Timer to hide z

Discussions about Mainlobby running on Apple mobile devices.
ricks
Is there life beyond Cinemar?
Is there life beyond Cinemar?
Posts: 1127
Joined: Wed Oct 27, 2004 7:01 pm
Location: Latham, Massachusetts
Contact:

Timer to hide z

Postby ricks » Tue Sep 28, 2010 1:01 pm

Here's one for the xhtml/js experts.

What I want to do is the following:
1. Press vol, bass, treble control button to adjust sound
2. The values of vol, bass, treble will overlay on top of cover art
3. Timer hides values after 3 seconds

I know I can use the following to make the values appear:
function ShowOptions() {
document.getElementById('__OptionsMenu').style.visibility='visible';

img onclick="ShowOptions();"

But is there any way to have them be hidden with a timer?

Thanks,
Rick

User avatar
CinemarDave
Site Admin
Site Admin
Posts: 10535
Joined: Fri Feb 07, 2003 8:56 am
Location: Planet Earth
Contact:

Re: Timer to hide z

Postby CinemarDave » Tue Sep 28, 2010 3:18 pm

Easy. When you press the button to change a value have the last line of the function be

setTimeout("HideElement('ElementID')", 1000);

Where HideElement is the function that is responsible for hiding the object by changing the visibility. The 1000 is the time in milliseconds before the function is fired.

Code: Select all

function HideElement(id) {
    document.getElementById(id).style.visibility='hidden';
}

ricks
Is there life beyond Cinemar?
Is there life beyond Cinemar?
Posts: 1127
Joined: Wed Oct 27, 2004 7:01 pm
Location: Latham, Massachusetts
Contact:

Re: Timer to hide z

Postby ricks » Tue Sep 28, 2010 3:48 pm

Cool. I'll give that a try!

Thanks,

ricks
Is there life beyond Cinemar?
Is there life beyond Cinemar?
Posts: 1127
Joined: Wed Oct 27, 2004 7:01 pm
Location: Latham, Massachusetts
Contact:

Re: Timer to hide z

Postby ricks » Wed Sep 29, 2010 10:50 am

Hey Dave,

Having just a bit of trouble placing the setTimeout("HideElement('ElementID')", 1000); in the button.

The button now looks like:

<img onclick="ShowElement();doCommand('Macro|Audio.{{music_activemusicsourcename_{{clientname}}}}.VolUp');" src="images/C_volup.png" width="80" height="50"/>

How exactly would I insert the setTimeout("HideElement('ElementID')", 1000); ?

Thanks
Rick

User avatar
CinemarDave
Site Admin
Site Admin
Posts: 10535
Joined: Fri Feb 07, 2003 8:56 am
Location: Planet Earth
Contact:

Re: Timer to hide z

Postby CinemarDave » Wed Sep 29, 2010 10:55 am

Since it looks like you already have a function for showing it I modified the hide to match your show. It would look like this.

Code: Select all

<img onclick="ShowElement();doCommand('Macro|Audio.{{music_activemusicsourcename_{{clientname}}}}.VolUp');setTimeout('HideElement()', 5000);" src="images/C_volup.png" width="80" height="50"/>

ricks
Is there life beyond Cinemar?
Is there life beyond Cinemar?
Posts: 1127
Joined: Wed Oct 27, 2004 7:01 pm
Location: Latham, Massachusetts
Contact:

Re: Timer to hide z

Postby ricks » Wed Sep 29, 2010 11:13 am

Wow. Works perfectly. What a great feature to save screen space!

Thanks,


Return to “MainLobby on iPhone, iPod Touch”

Who is online

Users browsing this forum: No registered users and 1 guest