Click here to Skip to main content
15,884,099 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hii,
i implemented three slidetoggle function based on button click.
for example if user click button1 first div will open remaining will be hide.if user click second button div2 will open remaining will hide,third one work like same like earler


here my issue is when user click button1 div1 is open thats time button background color,again click same button div will hide that's it's take earlier color,inthis time button2,button3 also works same.

i am using this java script code

C#
$("document").ready(function () {

      if ($("#HiddenField1").val() == "block") {
          $("#FiltersliderDiv").css("display", "none");

      }
      if ($("#HiddenField1").val() == "none") {
          $("#FiltersliderDiv").css("display", "block");
          $("#Filters").css('background-color', '#0082AA');
          $("#MapAndChart").css('background-color', '#0082AA');
          $("#Report").css('background-color', '#0082AA');
      }
      $("#filters").click(function () {



              $("#MapAndChartsliderDiv").slideUp("slow");
              $("#FiltersliderDiv").slideToggle("slow");
              $("#MapAndChartsliderDiv").slideUp("slow");
              $("#MapAndChart").css('background-color', 'Gray');
              $("#Filters").css('background-color', '#0082AA');
              $("#Filters").css('fontcolor', '#333333');
              $("#Report").css('background-color', 'Gray');

              document.getElementById("MapAndChart").style.color = "black";
              document.getElementById("Report").style.color = "black";
              document.getElementById("Filters").style.color = "White";



      });
  });

  $("document").ready(function () {
      var val1 = 0;
      if ($("#HiddenField2").val() == "block") {
          $("#MapAndChartsliderDiv").css("display", "none");
          $("#MapAndChart").css('background-color', 'Gray');
      }
      if ($("#HiddenField2").val() == "none") {
          $("#MapAndChartsliderDiv").css("display", "block");

      }
            }
    $("#MapAndChart").click(function () {



                      $("#FiltersliderDiv").slideUp("slow");
                      $("#ReportsliderDiv").slideUp("slow");
                      $("#MapAndChartsliderDiv").slideToggle("slow");
                      $("#MapAndChart").css('background-color', '#0082AA');
                      $("#Filters").css('background-color', 'Gray');
                      $("#Report").css('background-color', 'Gray');

                      document.getElementById("MapAndChart").style.color = "White";
                      document.getElementById("Report").style.color = "black";
                      document.getElementById("Filters").style.color = "black";

      });
  });
  $("document").ready(function () {

      if ($("#HiddenField3").val() == "block") {
          $("#ReportsliderDiv").css("display", "none");
          $("#Report").css('background-color', 'Gray');

      }
      if ($("#HiddenField3").val() == "none") {
          $("#ReportsliderDiv").css("display", "block");

      }
      $("#Report").click(function () {
          $("#FiltersliderDiv").slideUp("slow");
          $("#MapAndChartsliderDiv").slideUp("slow");
          $("#ReportsliderDiv").slideToggle("slow");
          $("#MapAndChart").css('background-color', 'Gray');
          $("#Filters").css('background-color', 'Gray');
          $("#Report").css('background-color', '#0082AA');

          document.getElementById("MapAndChart").style.color = "black";
          document.getElementById("Report").style.color = "White";
          document.getElementById("Filters").style.color = "black";
      });
  });
Posted
Updated 10-Mar-14 19:40pm
v2
Comments
Snesh Prajapati 11-Mar-14 1:32am    
Can you send code so we will come to what you are missing?
krish2013 11-Mar-14 1:43am    
Hi snesh,
please see the code here my issue when user first time click the button the slide will down that's time color change again click the same button slide will up that's color not changed paralally handle three slide toggle functions.
DotNet WeblineIndia 12-May-14 4:48am    
Hi, i don't know for what purpose you have consider multiple $('document').ready(). Can't you try to place all your code in single "$('document').ready()" and then trace it, you will get exact idea that what you have done wrong.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900