I have implemented a tree-view
navbar. Now I am trying to do when clicking the menu list slides down slowly. But my tried code is not working. How can I do this?
I have mentioned my tried code below -->
<ul>
<div class="cls2">
<li>
<ul class="nested nav nav-pills flex-column tog">
<li class="nav-item">
<a>lable</a>
</li>
</ul>
</li>
</div>
</ul>
只需为您使用 css 滑动的元素添加过渡
transition: all 0.3s; // example
It is possible to use next()
to grab the correct body element. Then slideToggle()
like this:
$(".treeparent").click(function () {
$(this).next('.tog').slideToggle();
});
$('.nav-item').on('show.bs.dropdown', function(e){
$(this).find('.tog').first().stop(true, true).slideDown('fast');
});
$('.nav-item').on('hide.bs.dropdown', function(e){
$(this).find('.tog').first().stop(true, true).slideUp('fast');
});
Slide up Down Fast is parameter or you can use Slow
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.