Skip to content Skip to sidebar Skip to footer

Smooth Toggle In Jquery

I am using some simple jQuery to animate a toggle button. The toggle works, however, no matter how I try changing values, I cannot seem to change the speed or smoothness of the ani

Solution 1:

Try to use slideToggle

Syntax

$(selector).slideToggle(speed,callback);

Here the optional speed parameter can take the following values: "slow", "fast", milliseconds.

So i think you need to put more time to get smooth animation.

Jquery

$(document).ready(function(){
  $("a.toggle").click(function(){
    $("nav ul").slideToggle(1500);
    $(this).toggleClass("open");
  });
});

Here is the working jsfiddle:https://jsfiddle.net/88bm4x6z/1/

Solution 2:

If any of you still not been able to slide smoothly, just set transition: none;. if you'r using it in your parent item or child, I stuck in it for 3 hours. Then I just set it to none, it worked.

Post a Comment for "Smooth Toggle In Jquery"