[英]Adding a sliding effect to bootstrap dropdown with angular
I am using Bootstrap 3 and trying to use show/hide.bs.dropdown to animate the dropdown menu. 我正在使用Bootstrap 3并尝试使用show / hide.bs.dropdown为下拉菜单设置动画。 It's working but I can only get it to work for the first menu item.
它正在工作,但我只能让它适用于第一个菜单项。 I don't know how to pass the $index from angular into the function.
我不知道如何将$ index从angular传递给函数。 Is there anything in the event that is passed in that I can use to index through the items or can I solve this using angular?
在传递的事件中是否有任何东西我可以用来索引项目或者我可以使用angular解决这个问题吗? I just want to use the slideDown and slideUp animations.
我只想使用slideDown和slideUp动画。
Here is my Javascript 这是我的Javascript
// ADD SLIDEDOWN ANIMATION TO DROPDOWN //
$('.dropdown').on('show.bs.dropdown', function (event) {
$(this).find('.dropdown-menu').first().stop(true, true).slideDown();
});
// ADD SLIDEUP ANIMATION TO DROPDOWN //
$('.dropdown').on('hide.bs.dropdown', function () {
$(this).find('.dropdown-menu').first().stop(true, true).slideUp();
});
This is an example of how the first element does it's animation when I click on the last. 这是我点击最后一个元素时第一个元素如何动画的示例。
Here is my HTML/angular 这是我的HTML /角度
<ul class="nav navbar-nav dropdown">
<li ng-repeat="xmenu in $ctrl.xactMenus.menuList">
<a class="dropdown-toggle navbar-brand" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{xmenu.menuName}} <span class="caret"></span></a>
<ul class="dropdown-menu">
<li ng-repeat="menuItem in xmenu.menuItems">
<a href="{{menuItem.path}}">{{menuItem.name}}</a>
</li>
</ul>
</li>
</ul>
Let me know if there is anything else I can add to help answer this question! 让我知道是否还有什么我可以添加来帮助回答这个问题! Thanks!
谢谢!
Can you show your angular test function? 你能展示你的角度测试功能吗? Sorry I dont have commenting facility.
对不起,我没有评论设施。 Please dont down vote.. :(
请不要投票.. :(
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.