当包装在另一个函数中时,动画不会触发。我已经尝试过这段代码的多种变体。请帮忙
这是我正在处理的内容。 http://jsfiddle.net/HHBN8/1/ 我试图在数据时为类设置动画返回为 false,并在数据返回为 true 时隐藏该类。动画代码本身可以正常工作,但是一旦我将其放入函数中,它就不会触发。有几件事,文档必须准备好让动画工作,并且我将动画放在与数据函数相同的函数中,因为我不知道如何访问该函数外部的变量。如果有更简单的方法可以做到这一点,请告诉我。非常感谢您的帮助,请记住,三周前我还不知道课程是什么。
Here is what I'm working with. http://jsfiddle.net/HHBN8/1/ I am trying to animate a class when the data comes back as false, and hide the class when the data comes back as true. The animation code works fine by itself, but as soon as I throw it into the function it won't fire. A couple of things, the document has to be ready for the animation to work, and I'm putting the animation in the same function as the data function because I can't figure out how to access the variable outside that function. If there is an easier way to do this let me know. Thanks so much for your help, and keep in mind 3 weeks ago I didn't know what a class was.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我做了一些更改,例如在另一个方法之外定义
A
方法(*这样您就不必将其绑定到window.load
事件。演示位于 http://jsfiddle.net/HHBN8/5/
注意:你没有任何 html ..所以没有什么可以制作动画..我在示例中添加了一些 html..
I made some alterations like defining the
A
method outside of the other one (*this way you do not have to bind it to thewindow.load
event.demo at http://jsfiddle.net/HHBN8/5/
note : you do not have any html .. so there is nothing to animate.. I added some html in the example..
我想这就是你想要的。看看这个小提琴
I think this is what you want. Check out this fiddle