Hi All,

Im trying to build a menu system and each button I add Im having to
add more and more code eg:

    $("#scaleButton").click(function(){
        $("#scaleDiv").fadeToggle(200) ;
                if($('#infoDiv').is(':visible')){
                        $("#infoDiv").fadeToggle(100) ;
                }
                if($('#saveDiv').is(':visible')){
                        $("#saveDiv").fadeToggle(100) ;
                }
    });
    $("#infoButton").click(function(){
        $("#infoDiv").fadeToggle(200) ;
                if($('#resizerDiv').is(':visible')){
                        $("#resizerDiv").fadeToggle(100) ;
                }
                if($('#saveDiv').is(':visible')){
                        $("#saveDiv").fadeToggle(100);
                }
    });
    $("#saveButton").click(function(){
        $("#saveDiv").fadeToggle(200) ;
                if($('#resizerDiv').is(':visible')){
                        $("#resizerDiv").fadeToggle(100) ;
                }
                if($('#infoDiv').is(':visible')){
                        $("#infoDiv").fadeToggle(100) ;
                }
    });

//

jQuery.fn.fadeToggle = function(speed, easing, callback) {
   return this.animate({opacity: 'toggle'}, speed, easing, callback);
};

so basically I have three buttons that open a div and hide the other
two, how can I put this in a loop so I dont have to keep adding if
statements?

Thanks

--

You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en.


Reply via email to