Jump to content

Recommended Posts

Hi, I'm wanting to toggle the opacity of the background everytime some clicks on the "control panel" button. It's initially hidden and if they click on it, it slowly fades in. If they click again, it slowly fades out; this was achieved using a simple fadeToggle. So far so good. Now, at the same time, I want the background (<body>) to slowly fadeTo an opacity of about say "0.5"; and then, of course, back to "1.0" if clicked again. Does anyone know of a good toggle function that can allow such a thing to occur?

 

Here's my current JQuery code. Can someone please insert that toggle function in my current function where it needs to go? Thanks in advance!

function slide_me() {
$("#controlPanel").fadeToggle(500);	
        <!--I'm assuming it would go here...?-->
}

$(document).ready(hide_panel);

function hide_panel() {
$("#controlPanel").hide();
}

 

EDIT: Another thing, is as soon as the document loads (or is "ready"), the control panel div is not being hidden. No idea what the problem here is with that. Does anyone see anything wrong in my code?

Link to comment
https://forums.phpfreaks.com/topic/232914-fadeto-on-with-toggle/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • 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.