在角js重新开始猫头鹰旋转木马不工作

时间:2016-09-09 04:00:53

标签: javascript jquery angularjs

我想在刷卡事件后重新初始化我的猫头鹰旋转木马,但它无效。

这是我的代码

$touch.bind('.wtoucharea', {
    end: function(touch) {
        console.log(touch);
        if(touch.direction == 'TOP' && touch.distance > 100){
            if($('.active img').attr('data-magtype') == 'video'){
                var userAgent = navigator.userAgent || navigator.vendor || window.opera;
                if( userAgent.match( /Android/i ) )
                {
                    window.open($('.active video'  [0].currentSrc+'#playvideo#0');
                }
                $('.active video').trigger('play');
            }else{
                // parent is element.parent() which is the owl carousel main div
                scope.reInitCarousel(parent);

                $('.active .wswipe-up').animateCss('fadeInUp', false);
                $('.active .wswipe-up').show();

            }
        }
    }
});

这是我的reInitCarousel函数:

scope.reInitCarousel = function(element) {

                console.log('reinitialized');
                console.log(element);
                var owl = $(element).data('owlCarousel');
                console.log(owl);
                $timeout(function() {
                    owl.reinit({ touchDrag: false, mouseDrag: false });

                });
            }

它显示错误:

Error: owl.reinit is not a function.link/scope.reInitCarousel/<@http:
//some.site/js/angApp.js?w=10:768:7
f/q<@http://some.site/js/angular.min.js:146:369
e@http://some.site/js/angular.min.js:43:303
Nf/k.defer/c<@http://some.site/js/angular.min.js:46:181
...a)}:function(a,b){e(a,null==b?"":b)}}return{log:e("log"),info:e("info"),warn:e("... angular.min.js (line 107)

angular read reinit作为其功能,而不是。 任何人都知道如何解决这个问题?

0 个答案:

没有答案