zoukankan      html  css  js  c++  java
  • 解决Ueditor在bootstarp 模态框中全屏问题

    基本的一些配置就不说了。先说一下要注意的问题:首先是zIndex的设置。记住最好都显示设置模态框和ueditor的zIndex。理清他们的层叠关系。

    特别是用到ueditor里面的图片上传功能的更要设好zIndex的值。具体要怎么设就不说了,有问题再讨论。

    然后是模态框里的全屏问题:通常请款下模态框都比较小,让用户在模态框里的编辑器写东西,用户体验肯定不好。所以要将ueditor全屏。要使ueditor能在bootstrap模态框里正常全屏显示需要修改ueditor.all.js里面的setFullScreen函数

    在 while (Container.tagName != "BODY") { }里面加上以下这段代码://解决在modal上ueditor不能全屏的问题

      

       var position = baidu.editor.dom.domUtils.getComputedStyle(container, "position");
                                nodeStack.push(position);
                                var isModal = false;
                                //判断该dom是否为modal
                                var classes = $(container).attr('class');
                                if (classes !== undefined) {
                                    classes = classes.split(' ');
                                    for (var i = 0; i < classes.length; i++) {
                                        if (classes[i] == "modal") {
                                            isModal = true;
                                        }
                                    }
                                }
                                //如果是modal,则不设置position为static
                                if (!isModal) {
                                    container.style.position = "static";
                                }
                                container = container.parentNode;
    

    其实就是判断ueditor的父container是不是bootstrap模态框。如果是,则不将container.style.position设为static。否则全屏的ueditor会被其他元素覆盖掉

  • 相关阅读:
    Redis面试题(46题)
    公共组件及脚手架webpack模板
    css3中@font-face模块自定义字体
    字段加密实践(django-fernet-fields)
    django导入导出excel实践
    vue-loader和单页组件介绍
    Axios介绍和使用
    微服务架构理解及微服务架构局限性
    v-model的双向数据绑定(表单)
    eureka集群
  • 原文地址:https://www.cnblogs.com/oceanwang/p/7122368.html
Copyright © 2011-2022 走看看