Hi, I am new to javascript and would like to get the menufader to reveal multiple divs
<script type=\"text/javascript\"> $(document).ready(function(){ //each click on a button will be intercepted $(\"#header div.button\").click(function(){
//we store the reference here to avoid doing $(this) each time we need and spare some processing $clicked = $(this);
// if the button is not already \"transformed\" AND is not animated if($clicked.css(\"opacity\") != \"1\" && $clicked.is(\":not(animated)\")) { //we animate it (remember the reference for optimisation ?) $clicked.animate({ opacity: 1, borderWidth: 5 }, 600 );
//we \"calculate\" the id to shown (each button div MUST have a \"xx-button\" and the target div must have an id \"xx\" ) //yet again the reference var idToLoad = $clicked.attr(\"id\").split('-'); //we search trough the content for the visible div and we fade it out $(\"#content\").find(\"div:visible\").fadeOut(\"fast\", function(){ //once the fade out is completed, we start to fade in the right div $(this).parent().find(\"#\"+idToLoad[0]).fadeIn(); }) }
//we reset the other buttons to default style $clicked.siblings().animate({ opacity: 0.5, borderWidth: 1 }, 600 );
}); }); </script>
Now it only make visible a div and not the childs\class of these last one.
If somebody has a clu that would lead me somewhere, ike a tutorial on multiple function for javascript, that would be awesome.
well i guess i solved it. maybe a bit dirt but it works
if added:
$(this).parent().find(\"MYDIV\").fadeIn();
after this one
$(\"#content\").find(\"div:visible\").fadeOut(\"fast\", function(){ //once the fade out is completed, we start to fade in the right div $(this).parent().find(\"#\"+idToLoad[0]).fadeIn();
I am new to javascript and would like to get the menufader to reveal multiple divs
Now it only make visible a div and not the childs\class of these last one.
If somebody has a clu that would lead me somewhere, ike a tutorial on multiple function for javascript, that would be awesome.
Cheers
If it can only affect the top div and not the childs that would solve it.
if added:
after this one
$(\"#content\").find(\"div:visible\").fadeOut(\"fast\", function(){//once the fade out is completed, we start to fade in the right div
$(this).parent().find(\"#\"+idToLoad[0]).fadeIn();
If somebody as a better trick let me know :)
Trying to figure things out again:P
here's my latest code. If somebody knows the trick let me know :)