繁体   English   中英

jQuery niceScroll无法与w.load()一起使用

[英]jQuery niceScroll Not Working Along w/ .load()

我在我的DIV中实现了jQuery插件niceScroll 除了将.load()函数添加到使用niceScroll的标记中外 ,它无法正常工作。 但是,如果我删除niceScroll,则本机滚动条可以正常工作...?

这是针对webKit浏览器的。 有任何想法吗,或者我是代码中的傻瓜?

$(document).ready(
            function(e) {

                $("#west").load('http://mySite.comregulatory_list.php', '', function(response, status, xhr) {
                    if (status == 'error') {
                        var msg = "Sorry but there was an error: ";
                        $(".content").html(msg + xhr.status + " " + xhr.statusText);
                    }

                });

                $("#west").niceScroll({
                    cursorcolor : "#6699FF",
                    cursorwidth : "2px",
                    grabcursorenabled : "false",
                    preservenativescrolling : "false",
                    cursorborder : "0px",
                    scrollspeed : "20",
                });
            })

niceScroll插件几乎可以肯定正在更新#west元素的HTML结构,因此,您应该以#west元素内的特定内容容器为目标,或者在加载新内容时重新初始化niceScroll插件:

            $("#west").load('http://mySite.comregulatory_list.php', '', function(response, status, xhr) {
                if (status == 'error') {
                    var msg = "Sorry but there was an error: ";
                    $(".content").html(msg + xhr.status + " " + xhr.statusText);
                } else {
                    $(this).niceScroll({
                        cursorcolor : "#6699FF",
                        cursorwidth : "2px",
                        grabcursorenabled : "false",
                        preservenativescrolling : "false",
                        cursorborder : "0px",
                        scrollspeed : "20",
                    });
                }

            });

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM