I am implementing a slide dropdown and i am using this code
$(document).ready(function(){
$('.drop').click(function(){
var $next = $(this).parent().next('li.drop_down');
if($next.is(':visible')) {
$next.slideUp();
} else {
$next.slideDown();
}
});
});
but the client claims that it is not smooth enough. He wants to expand really smooth, so is there a way to make it smoother
您可能希望合并缓动插件以获得更流畅的动画。
如果你的动画不平滑,你需要给slidedUp / slidedDown的元素一个像素宽度(不是百分比!),这在大多数时候都有帮助。
I just came across your question and I have the same problem. For men what fixed it is to remove padding. I don't know but for some reason it is not taken into account as a total of the element's height.
You could try the jQuery UI library. The Event() class provides a Slide effect where you can adjust speed and other presentation-related attributes
You can incrase the animation duration by adding a number of ms inside the slideUp/slideDown()'s:
if($next.is(':visible')) {
$next.slideUp(2500);
} else {
$next.slideDown(2500);
}
That should get all the smoothness you need.
according to all answers and my experience:
ps 1: you can use responsive width (in percent), but you have remove padding (set internal container element padding).
ps 2: you can use fixed width and padding together, sometimes its work properly.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.