jamesjmann Posted April 6, 2011 Share Posted April 6, 2011 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? Quote Link to comment https://forums.phpfreaks.com/topic/232914-fadeto-on-with-toggle/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.