代码之家  ›  专栏  ›  技术社区  ›  rosu alin

接吻聊天有很多元素在上面,我怎样才能解决这个问题?

  •  0
  • rosu alin  · 技术社区  · 7 年前

     !function(e,n,t,r){
            function o(){try{var e;if((e="string"==typeof this.response?JSON.parse(this.response):this.response).url){var t=n.getElementsByTagName("script")[0],r=n.createElement("script");r.async=!0,r.src=e.url,t.parentNode.insertBefore(r,t)}}catch(e){}}var s,p,a,i=[],c=[];e[t]={init:function(){s=arguments;var e={then:function(n){return c.push({type:"t",next:n}),e},catch:function(n){return c.push({type:"c",next:n}),e}};return e},on:function(){i.push(arguments)},render:function(){p=arguments},destroy:function(){a=arguments}},e.__onWebMessengerHostReady__=function(n){if(delete e.__onWebMessengerHostReady__,e[t]=n,s)for(var r=n.init.apply(n,s),o=0;o<c.length;o++){var u=c[o];r="t"===u.type?r.then(u.next):r.catch(u.next)}p&&n.render.apply(n,p),a&&n.destroy.apply(n,a);for(o=0;o<i.length;o++)n.on.apply(n,i[o])};var u=new XMLHttpRequest;u.addEventListener("load",o),u.open("GET","https://"+r+".webloader.smooch.io/",!0),u.responseType="json",u.send()
        }(window,document,"Smooch",smooch_key);
    

    我就是这样开始的:

        function initSmooch() {
        if (!$rootScope.smooch_inited) {
            try {
                var window_focus = true;
                $(window).focus(function() {
                    window_focus = true;
                }).blur(function() {
                    window_focus = false;
                });
    
                Smooch.on('message:received', function() {
                    if (!window_focus || !Smooch.isOpened()) {
                        //Play sound
                        var audio = new Audio('assets/audio/ding.wav');
                        audio.play();
                    }
                    Smooch.open();
                });
                var promise = Smooch.init({
                    appId: smooch_key,
                });
                promise.then(function() {
                    $('#sk-holder').addClass('no-print');
                    $rootScope.smooch_inited = true;
                    Smooch.updateUser({
                        givenName: $rootScope.data.user.first_name,
                        surname: $rootScope.data.user.last_name,
                        properties: {
                            email: $rootScope.data.user.email,
                            uid: $rootScope.data.user.id,
                            language: $rootScope.data.user.language,
                            country: $rootScope.data.user.country
                        }
                    });
                });
            } catch(e) {
                console.log("error trying to init smooch: " + e);
                $timeout(function() {
                    initSmooch();
                }, 1000);
            }
        }
    }
    

    看了,但我没有我添加视图的地方,所以我不知道如何修改,强迫它在上面。有什么想法吗?

    Example Picture

    1 回复  |  直到 7 年前
        1
  •  2
  •   mspensieri    7 年前

    这看起来像是webmessenger的Z索引和它下面的元素之间存在冲突。webmessenger的z指数已经非常高了 9998 ,但要解决此问题,您需要进一步增加该值,或者减少显示在顶部的元素的z索引。

    #web-messenger-container {
        z-index: 9998;
    }
    

    或者针对有问题的元素编写一个类似的规则,并给它们一个较低的数字