0

我正在尝试使用 AngularJS 网站上的完美滚动条插件,但出现错误:

TypeError: element.getAttribute 不是Object.exports.get ( http://localhost/Myproject的 getId ( http://localhost/Myproject/js/lib/perfect-scrollbar.jquery.js:1299:20 ) 的函数/js/lib/perfect-scrollbar.jquery.js:1334:20 )

做了什么:

// connections
link href="css/perfect-scrollbar.min.css" rel="stylesheet" type="text/css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script src="js/lib/perfect-scrollbar.jquery.js"></script>
<script src="js/lib/perfect-scrollbar.js"></script>

//styles
.carousel-in-circles {
  position: relative;
  overflow: hidden;
  width: 100%; /* I need horizontal scrollbar only */
}

// directive use
<div class="carousel-in-circles" perfect-scrollbar>...</div>

// angularJS directive
angular.module('myproject.directives').
    directive('perfectScrollbar', function () {
        return {
            link: function (el) {
                $(document).ready(function (){
                    $(el).perfectScrollbar();
                });                
            }
        };
    });

实在受不了了,求指教。。。

4

1 回答 1

0

如果您的网站是有角度的,那么我会在这里使用完美滚动条的有角度版本:

https://github.com/itsdrewmiller/angular-perfect-scrollbar

在 Angular 之上使用 jQuery 插件并不是它的设计初衷。

于 2015-12-24T14:18:50.573 回答