jQuery的mCustomScrollbar不工作的Ajax内容 [英] jQuery mCustomScrollbar not working on ajax content

查看:183
本文介绍了jQuery的mCustomScrollbar不工作的Ajax内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  $(窗口).load(函数(){
                $(#content_1)。mCustomScrollbar({
                    scrollButtons:{
                        启用:真
                    }
                });

// AJAX code
功能beauty_of_ceylon(){
  $('内容的文字。)HTML('< p风格=的位置是:绝对的;>< IMG SRC =图像/ AJAX-loader.gif/>< / P>') ;
  $('。内容文本)的负载(套餐美容-ceylon.php的/)。
}
 

解决方案

  $('。内容文本)。负载(包/美容-ceylon.php的,功能 () {
    $(#content_1)。mCustomScrollbar({
        scrollButtons:{
            启用:真
        }
    });
    $内容='<按钮ID =升级的onclick =$('#content_1)mCustomScrollbar。('更新');风格=显示:无>< /按钮>';
    $('。内容文本)追加($内容)。
    的setTimeout($('#更新)点击();,10);
});
 

这工作对我来说:D

    $(window).load(function(){
                $("#content_1").mCustomScrollbar({
                    scrollButtons:{
                        enable:true
                    }
                });

// ajax code
function beauty_of_ceylon() {
  $('.content-text').html('<p style="position:absolute;"><img src="images/ajax-loader.gif" /></p>');
  $('.content-text').load("packages/beauty-of-ceylon.php");
}

解决方案

$('.content-text').load("packages/beauty-of-ceylon.php", function () {
    $("#content_1").mCustomScrollbar({
        scrollButtons:{
            enable:true
        }
    });
    $content = '<button id="update" onclick="$('#content_1').mCustomScrollbar('update');" style="display:none"></button>';
    $('.content-text').append($content);
    setTimeout("$('#update').click();",10);
});

It work for me :D

这篇关于jQuery的mCustomScrollbar不工作的Ajax内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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