$(".induction-group").bind("DOMSubtreeModified", function(event) {
$(this).trigger("currentPosition", function( page ) {
number_of_claims = $(this).find(".claim").length;
element = $(this).find('.induction-claim-counter').first();
element.html("Example # " + (page+1) + "/" + number_of_claims);
});
});
这在chrome中工作正常,但是完全冻结了firefox和IE。
.诱导-组内容
<div class="row claim-depth-<%#= claim.depth - root_claim.depth %>">
<div class="claim">
<div class="claim-id"> <%= claim.id %> </div>
<div class="col-xs-1 claim-icon">
<span class="glyphicon glyphicon-align-justify"></span>
</div>
<div class="col-xs-6 claim-text hidden-sm hidden-xs induction-claim-text">
<div class="induction-background-1"></div>
<div class="induction-background-2"></div>
<div class="induction-background-3"></div>
<div class="prev-claim">
<span class="glyphicon glyphicon-arrow-left">
</div>
<div class="next-claim">
<span class="glyphicon glyphicon-arrow-right">
</div>
<div class="induction-claim-counter"> <-- !!!!!!! -->
</div>
<%= claim.text %>
</div>
...............
text()和val()函数根本不工作。有什么想法吗?
发布于 2013-11-02 21:16:57
您可能正在创建一个竞赛condition....since,您将在监视DOM更改的事件处理程序中修改DOM。如果你解释了你为什么要使用它,也许你会得到其他的选择。
阅读MDN文档中的红色光盘
Be very careful with this event it is easy to cause an infinite loop if you decide to change the DOM inside the event handler.
发布于 2013-11-02 21:14:22
也许jquerys .append ()?我不是百分之百确定
https://stackoverflow.com/questions/19746893
复制相似问题