【问题标题】:fadeIn into jQuery Template tmpl()淡入到 jQuery 模板 tmpl()
【发布时间】:2012-02-07 19:27:24
【问题描述】:

我最终使用了 jquery 模板,到目前为止一切正常,但现在我想将一个新对象淡入到我的“模板”中,我正在尝试这个,但没有成功:

$("#itemsTemplate").tmpl(responseText).prependTo( "#map_right_wrap_template" ).fadeIn();

上下文: - responseText 是一个表单提交返回的 json 对象

换句话说,我想以一种非常时尚的方式将新返回的元素添加(淡入)到模板中。正如我所说,除了淡入淡出之外,一切正常。

【问题讨论】:

    标签: jquery jquery-templates


    【解决方案1】:

    您确定元素在添加到 DOM 之前是隐藏的吗?您可以在将元素添加到 DOM 之前使用 .hide() 以确保它会开始隐藏,然后淡入:

    $("#itemsTemplate").tmpl(responseText).hide().prependTo( "#map_right_wrap_template" ).fadeIn(500);
    

    【讨论】:

      猜你喜欢
      • 2014-02-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-18
      • 2013-05-28
      • 2023-03-14
      • 1970-01-01
      • 2013-02-27
      相关资源
      最近更新 更多