weixin_33694620 2013-06-16 07:04 采纳率: 0%
浏览 58

iScroll Ajax内容

i have problem with refreshing content in wrapper after it is loaded by ajax.

When i check with firebug - XHR is showing request and i can see elements loaded but it isn't showing on page.

This is what i am using for pullDown function to get ajax content

function pullDownAction () {
    setTimeout(function () {   
        var el, li, i;
        el = document.getElementById('thelist');
        var http = new XMLHttpRequest();
        var url = window.location;
        http.open("GET",url,true);
        http.send();
        myScroll.destroy();
                myScroll = null;
                loaded();
  }, 1000);   
}

It looks like as content is stuck between showing on webpage and ajax request.

Any idea?

  • 写回答

1条回答 默认 最新

  • weixin_33725807 2013-07-11 10:43
    关注

    myScroll.refresh() (instead of .destroy() and recalling "loaded()") should do the trick! If you're using IScroll4 you can try to use the checkDOMChanges:true option of iscroll.

    If it still won't work - it could be a CSS issue caused by the scroll-wrapper (#scroller) not expanding with its content. (float,position:absolute; or something like that)

    EDIT: it seems to me as you're not handling a responseText of the request at all!

    According to this example you need an event handler for the onreadystatechange event:

     http.open("GET",url,true);
     http.onreadystatechange = function () {
           if (http.readyState == 4) {
              alert(http.responseText); //handle this response! (i.e. writing to an element's innerHTML)
          }
     };
     http.send(null);
    
    评论

报告相同问题?

悬赏问题

  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制