jquery移动触发器创建方法
我想知道在动态注入表之后如何调用.trigger("create")
方法。
我在jquery移动文档中找到了这个
$("...new markup that contains widgets...") .appendTo(".ui-page") .trigger( "create" );
但是,(由于我的知识有限)我不知道我必须更换包含小部件的新标记……用 – 是我正在使用的表的ID吗?
这是我到现在为止所尝试的:
JS
$(".ui-responsive").trigger("create");
如何注入HTML
{ title:'test-jqry', content:'Rank Movie Title Year Rating Reviews 1 Citizen Kane 1941 100% 74 2 Casablanca 1942 97% 64 3 The Godfather 1972 97% 87 4 Gone with the Wind 1939 96% 87 5 Lawrence of Arabia 1962 94% 87
' }
这是一个演示: http : //jsbin.com/umatel/1/edit
根据jQuery Mobile的文档 ,你不能在单个元素上调用trigger
。 在元素的父元素上调用它。 在您的情况下,将是div[data-role=page]
。 因此,在将 HTML注入页面后,请按以下方式调用触发器:
//first is the div with data-role set to page. for more info, see demo $("#first").trigger("create");
希望这可以解决问题。