javascript 使用 AngularJS 创建幻灯片效果?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13437981/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Create slide effect using AngularJS?
提问by mkat
I am new to AngularJS framework and I am trying to get slide effect same as jQuery provides, I did google too much but didn't find anything related to it. So if any one has any idea about that please guide me to achieve that thank you.
我是 AngularJS 框架的新手,我正在尝试获得与 jQuery 提供的相同的幻灯片效果,我在谷歌上搜索了太多但没有找到任何与之相关的内容。因此,如果有人对此有任何想法,请指导我实现这一目标,谢谢。
回答by Christophe L
You might find AngularUIuseful if you want to animate DOM object insertion (check the animate directive).
如果您想要动画 DOM 对象插入(检查 animate 指令),您可能会发现AngularUI很有用。
---- Update -----
- - 更新 - - -
Newer versions of Angular (1.1.4+ I believe) add a ngAnimate directive especially made for adding CSS animation to Angular apps. Check the offical docs (http://code.angularjs.org/1.1.4/docs/api/ng.directive:ngAnimate) or http://www.nganimate.org/.
较新版本的 Angular(我相信 1.1.4+)添加了一个 ngAnimate 指令,专门用于向 Angular 应用程序添加 CSS 动画。检查官方文档(http://code.angularjs.org/1.1.4/docs/api/ng.directive:ngAnimate)或http://www.nganimate.org/。
回答by Roy Truelove
You can (and should) use the jQuery slide, but wrap it in an angular directive. Check the docs about directives and also this video.
您可以(并且应该)使用 jQuery 幻灯片,但将其包装在 angular 指令中。检查有关指令的文档以及此视频。
回答by Ron
In general, you should not be using jQuery directly with Angular, even in directives. It is a last resort. Here is another good post on the topic here on SO.
一般来说,你不应该直接在 Angular 中使用 jQuery,即使在指令中也是如此。这是最后的手段。这是关于 SO 主题的另一篇好文章。
回答by Kirill Shur
In my humble opinion ui.bootstrap covers this issue, for instance this basic example http://surecode.me
在我看来 ui.bootstrap 涵盖了这个问题,例如这个基本示例http://surecode.me