ace ajax加载,jquery - how to use Ace_Scroll after ajax request - Stack Overflow

博客内容涉及了一个在Ajax加载数据后,如何正确应用滚动条到内部div而不是外部div的问题。作者发现将滚动条应用到外层的'MyDiv'导致了问题,而应该在返回的HTML内容中创建一个新的div,并将滚动条应用到这个新div上。通过这样做,成功解决了滚动条不正常工作的问题。
摘要由CSDN通过智能技术生成

I was having the same problem, it turns out that applying the scroll on the outer div was causing the problem. In your case, applying scroll on 'MyDiv' is the issue. Instead of applying scroll on 'MyDiv', you should have a div in the html returned from the ajax call, and apply scroll on that div.

var out = '';

var dv = $('#Mydiv');

$.ajax({

url: url,

type: 'POST',

data:{pg:pg},

error: function() {

return;

},

dataType: 'html',

success: function(data) {

if(data.trim() !=='ERROR'){

//Here the html in data.trim() should have an enclosing div like

...content...

out = data.trim();

dv.append(out);

}

},

complete:function(v){

/NOT WORK//

//Don't apply scroll on dv

//dv.ace_scroll({inline_style:true,size: 200,observeContent:true, mouseWheelLock: true});

//Apply scroll on the inner div

$('#MyScrollDiv').ace_scroll({inline_style:true,size: 200,observeContent:true, mouseWheelLock: true});

}

});

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值