Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ajax Result (append <li>...</li>): Uncaught TypeError: Cannot read property 'object' of undefined #41

Open
bkduck opened this issue Nov 8, 2016 · 2 comments

Comments

@bkduck
Copy link

bkduck commented Nov 8, 2016

Firstly I init "$('#gallery').poptrox()" ,and then I use ajax to load data (append under $('#gallery') ).Finaly I slide down & click the , but it cause the error which is Uncaught TypeError: Cannot read property 'object' of undefined. How to use poptrox.js when using ajax?

@bkduck
Copy link
Author

bkduck commented Nov 8, 2016

My Js code:
` $(function(){

   // poptrox view big pic
    var t= $('#gallery').poptrox({
        usePopupCaption: true
      });
    console.log(t);

    // dropload
    $('.items').dropload({
        scrollArea:window,
        domDown : {
            domClass   : 'dropload-down',
            domRefresh : '<div class="dropload-refresh"><i class="rs-upbtn-icon"></i>上拉显示下10条</div>',
            domLoad    : '<div class="dropload-load"><span class="loading"></span>正在加载...</div>',
            domNoData  : '<div class="dropload-noData rs-jobs-tips"><p>--没有更多订单详情了--</p></div>'
        },
        loadDownFn : function(me){

          //for ajax result
          var result = '';
          for(var i = 0; i < 6; i++){
              result += '<li><a href="../images/20160525155251.png" ><img src="../images/20160525155251.png" alt=""><p><i>1110000</i></p><span><img src="../images/new.png" alt=""></span></a></li>';
          }
          setTimeout(function(){
              $('.items-list').append(result);

              //+++++++++++++++++++++++++++ BUG Line +++++++++++++++++++++++++++++++++++//
              t.poptrox({
                  usePopupCaption: true
              });
              me.resetload();
          },500);`

@bkduck
Copy link
Author

bkduck commented Nov 8, 2016

I resolved the problem!!! I changed Line 851 queue.push(x) to queue[index] = x; IN file (jquery.poptrox.js v2.5.1) ! I debug by chorm and found that the ajax data overwrited origin 'queue',so 'queue' always had 6 data (Not ADD)! When I click the new '', it could not find true index in ‘queue’

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant