简体   繁体   English

来自json2html转换的jQuery动画表

[英]jQuery animate table from json2html transform

I cannot animate with CSS3 because the properties are not yet standard across browsers. 我无法使用CSS3制作动画,因为这些属性在所有浏览器中都不是标准的。

I can create a div table with json2html. 我可以使用json2html创建div表。

I can animate a row by setting {height:(toggle)?'show':'hide', opacity: (toggle)?1:0}, function(){ $(this).css('display', (toggle)?'auto':'none').css('height', ) } with jQuery to make rows appear and disappear. 我可以animate通过设置行{height:(toggle)?'show':'hide', opacity: (toggle)?1:0}, function(){ $(this).css('display', (toggle)?'auto':'none').css('height', ) }并使用jQuery使行显示和消失。

What I cannot do is put them together. 我不能做的就是把它们放在一起。 I've seen the json2html examples (Examples->jquery) , and they apply functions, but even if I understood how the functions are being applied, I'd still have no idea how to incorporate animate. 我已经看过json2html示例(Examples-> jquery) ,并且它们应用了函数,但是即使我了解函数的应用方式,我仍然不知道如何合并动画。

How can jQuery $.aniamte() be called on a json2html constructed element from a json2html transform? 如何通过json2html转换在json2html构造元素上调用jQuery $.aniamte()

Figure this is a little old but worth commenting on .. 图这有点旧,但值得评论..

json2html maps attributes with the starting characters "on" to events, so json2html将带有开始字符“ on”的属性映射到事件,因此

onclick -> jquery event "click" onfocus -> jquery event "focus" onclick-> jquery事件“ click” onfocus-> jquery事件“ focus”

which uses the function $.on( event,...) to register the event. 它使用$ .on(event,...)函数注册事件。 This means you can use any event that $.on() recognizes. 这意味着您可以使用$ .on()识别的任何事件。 For more documentation on $.on() 有关$ .on()的更多文档

Since strictly speaking $.animate isn't an event, but rather a jquery function you won't be able to use it with the json2html. 由于严格来说$ .animate不是事件,而是jquery函数,因此您将无法在json2html中使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM