Issue on Adding Animation to jQuery toggleClass()
Can you please take a look at
This Demo
and let me know how I can add Animation / Speed or Duration to the following code
- $("#ecolomodel").on("click",function(){
- $("#ecolomodelno").toggleClass("switchshow switchhiden");
- $("#ecolomodelyes").toggleClass("switchhiden switchshow");
- });
using this mark up
- <div class="panel panel-default">
- <div class="panel-heading">Switch</div>
- <div class="panel-body">
- <div class="row">
- <div class="switch col-lg-offset-1 col-md-offset-1 col-sm-offset-1 col-xs-offset-1 col-lg-10 col-md-10 col-sm-10 col-xs-10">
- <button id="ecolomodelno" class="btn btn-primary switchshow norightradius col-lg-1 col-md-1 col-sm-2 col-xs-3">No</button>
- <button id="ecolomodel" class="btn btn-primary noradius col-lg-11 col-md-11 col-sm-8 col-xs-9">New Model</button>
- <button id="ecolomodelyes" class="btn btn-primary switchhiden noleftradius col-lg-1 col-md-1 col-sm-2 col-xs-3">Yes</button>
- </div>
- </div>
- </div>
- </div>
I already tried something like
- $("#ecolomodel").on("click",function(){
- $("#ecolomodelno").toggleClass("switchshow switchhiden", 6000);
- $("#ecolomodelyes").toggleClass("switchhiden switchshow", 6000);
- });
but it didn't work!. Thanks