重新初始化jQuerytools覆盖AJAX加载元素 [英] Reinitialize jQuerytools Overlay on ajax loaded element

查看:149
本文介绍了重新初始化jQuerytools覆盖AJAX加载元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想重新初始化新的AJAX加载元素的叠加。 在这里,我的code:

I am trying to reinitialize a Overlay on new ajax loaded elements. Here my code:

  $('input.search-files').keyup(function(event){
      if( event.keyCode == 13 ) {

          $.ajax({
          type: "GET",
          url: ...,
          dataType: "html",
          data: {...},
          beforeSend: function(){ 
              $('.tr-documento').fadeOut('fast', function(){ $(this).remove(); });
              $('.table-content').find('.table-loader').show(); 
          },
          success: function(data) {
              if( $(data).filter('tr').length == 0 ){ 
                  $('.table-loader').before( '<tr class="tr-documento"><td colspan="10">Non ci sono</td></tr>' ); 
              } else{
                  $('.table-loader').before( $(data).filter('tr') );
              }        
             $('.table-content').find('.table-loader').hide();
             $("table.table-content").tablesorter({headers: { 0: { sorter: false }, 6: { sorter: false },7: { sorter: false },8: { sorter: false },9: { sorter: false } } });
             reInitializeAjaxed();
             $(".modifica-file[rel]").overlay();
        }
      });
    }
  });

此功能被触发的ENTERKEYUP。 一切都做工精细,台分拣机工作在第一击。 jQuerytools叠加事件相反,只绑定在第二主打的ENTER。

This function is triggered on "ENTER" keyup. Everything work fine, table sorter works at first hit. jQuerytools overlay event instead, is binded only at the second hit on "ENTER".

有人知道这个问题? 有没有一种方法,以活叠加事件,而不是重新初始化每个Ajax调用? 我想这样的:

Someone knows this issue? Is there a way to "live" overlay event and not re-init each ajax call? I tried this:

$(document).delegate('.modifica-file[rel]', 'load', function(){ $(".modifica-file[rel]").overlay(); });

但不工作。

推荐答案

,我发现这里的解决方案:的 http://flash.flowplayer.org/forum/tool​​s/40/21252

I found solution here: http://flash.flowplayer.org/forum/tools/40/21252

有许多解决方案这个环节上,我使用了以下内容:

There are many solutions on this link, i am using the following:

$(".modifica-file[rel]").live('click', function () {
 $(this).overlay().load();
 $(this).overlay().load();
 return false;
});

我觉得这是很肮脏的解决方案... $。生活()不支持的方法是不再对最新的jQuery版本的...但我使用1.7.2,这是工作的罚款!

I think this is quite dirty solution...$.live() method is not supported anymore on latest jQuery versions...but i am using 1.7.2 and it is working fine!

我说这个片段成功AJAX回调结束。

I added this snippet to end of SUCCESS AJAX callback.

这篇关于重新初始化jQuerytools覆盖AJAX加载元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆