Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
HTML Code :-

XML
<div class="toggler">
  <div id="effect" class="ui-widget-content ui-corner-all" style="display:none">
    <h3 class="ui-widget-header ui-corner-all">Toggle 1</h3>

  </div>

    <div id="effect1" class="ui-widget-content ui-corner-all" style="display:none">
    <h3 class="ui-widget-header ui-corner-all">Toggle 2</h3>

  </div>
</div>


XML
<a href="#" id="button" class="ui-state-default ui-corner-all">Run Effect 1</a>
<a href"#" id="btn" class="ui-state-default ui-corner-all">Run Effect 1 </a>



jquery code :-

C#
<script>
     $(function()
        {
              // run the currently selected effect
           function runEffect()
            {
                // get effect type from
                 var selectedEffect = 'fold';

                // most effect types need no options passed by default
                 var options = {};

                // run the effect
                 $( "#effect" ).toggle( selectedEffect, options, 500 );
             };

        // set effect from select menu value
            $( "#btn" ).dblclick(function()
               {
              runEffect();
              return false;
               });



                 function runEffect1()
            {
                // get effect type from
                 var selectedEffect1 = 'drop';

                // most effect types need no options passed by default
                 var options1 = {};

                // run the effect

                 $( "#effect1" ).toggle( selectedEffect1, options1, 500 );
             };

        // set effect from select menu value
           $( "#button" ).click(function()
               {
              runEffect1();
              return false;
               });
         });
 </script>



how to show only one toggle at a time please help me
Posted
Comments
[no name] 25-Sep-13 6:06am    
MAYANK GEETE 25-Sep-13 8:39am    
it's just a name ..see ids r diff...it's doesn't matter on this code

C#
<script>
      $(function()
         {
               // run the currently selected effect
            function runEffect()
             {
                 // get effect type from
                  var selectedEffect = 'drop';

                 // most effect types need no options passed by default
                  var options = {};

                 // run the effect
                 $("#effect1").hide("drop");
                  $( "#effect" ).toggle( selectedEffect, options, 500 );

              };

         // set effect from select menu value
             $( "#btn" ).dblclick(function()
                {
               runEffect();
               return false;
                });



                  function runEffect1()
             {
                 // get effect type from
                  var selectedEffect1 = 'drop';

                 // most effect types need no options passed by default
                  var options1 = {};

                 // run the effect
              $("#effect").hide("drop");
                  $( "#effect1" ).toggle( selectedEffect1, options1, 500 );

              };

         // set effect from select menu value
            $( "#button" ).click(function()
                {
               runEffect1();
               return false;
                });
          });
  </script>
 
Share this answer
 
i found the solution :-
C#
<script>
      $(function()
         {
               // run the currently selected effect
            function runEffect()
             {
                 // get effect type from
                  var selectedEffect = 'drop';

                 // most effect types need no options passed by default
                  var options = {};

                 // run the effect
                 $("#effect1").hide("drop");
                  $( "#effect" ).toggle( selectedEffect, options, 500 );

              };

         // set effect from select menu value
             $( "#btn" ).dblclick(function()
                {
               runEffect();
               return false;
                });



                  function runEffect1()
             {
                 // get effect type from
                  var selectedEffect1 = 'drop';

                 // most effect types need no options passed by default
                  var options1 = {};

                 // run the effect
              $("#effect").hide("drop");
                  $( "#effect1" ).toggle( selectedEffect1, options1, 500 );

              };

         // set effect from select menu value
            $( "#button" ).click(function()
                {
               runEffect1();
               return false;
                });
          });
  </script>
 
Share this answer
 
v2

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