html - Smooch 聊天上面有元素,我该如何解决这个问题?

标签 html css layout smooch bringtofront

我正在使用这个库:

 !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);
        }
    }
}

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

Example Picture

最佳答案

这看起来在 Web Messenger 的 Z 索引和它下面的元素之间存在冲突。 Web Messenger 已经有一个非常高的 9998 的 z-index,但要解决这个问题,您要么需要增加该值,要么减少出现在顶部的元素的 z-index .

对于前者,您可以在页面上插入此 CSS 规则并将值调整为合适的值:

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

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

关于html - Smooch 聊天上面有元素,我该如何解决这个问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52312120/

相关文章:

javascript - 如何将table2放在table1下面?

javascript - 如何将EventListener添加到html链接?

javascript - 如何在带有语法提示的语音合成中插入停顿

java - 将 JComponents 与 JPanel 的左侧和右侧对齐

html - 带有 chrome 复选框的白色背景

html - CSS 定位错误

css - 我应该使用什么标签而不是 html 中弃用的标签字体(不能使用 CSS)

css - 如何为图形元素 (CSS) 中的 img 元素创建样式规则

layout - CSS3 : Floating first div between second and third

kotlin - 无法在 Desktop 中为 Compose 设计 UI 布局