• 父子元素select悬浮代码,兼容火狐


        //公共切换方法
        function SwitchCommon() {
            //悬浮显示
            $(document.body).on("mouseenter", "[hex-eidtstate]", function (event) {
                event.stopPropagation();
                //发布对象特殊处理
                if ($(this).attr("hex-eidtstate") == "publish") {
                    $(this).find(".name").addClass("hide");
                    $(this).find(".panel").removeClass("hide");
                    return false;
                }
                $(this).find(".name").each(function () {
                    if ($(this).hasClass("hide")) {
                        $(this).removeClass("hide");
                    } else {
                        $(this).addClass("hide");
                    }
                })
            })
            $(document.body).on("mouseleave", "[hex-eidtstate]", function (event) {
                event.stopPropagation();
                //发布对象特殊处理
                if ($(this).attr("hex-eidtstate") == "publish") {
                    $(this).find(".panel").addClass("hide");
                    $(this).find(".name").removeClass("hide");
                    return false;
                }
                $(this).find(".name").each(function () {
                    if ($(this).hasClass("hide")) {
                        $(this).removeClass("hide");
                    } else {
                        $(this).addClass("hide");
                    }
                })
            })
        }
        //火狐浏览器增强代码
        function firefoxUpdate() {
            var agentInfo = navigator.userAgent.toLowerCase();
            //如果是'火狐'
            if (agentInfo.indexOf('firefox') > 0) {
                console.log("firefox");
                //对于火狐浏览器,select作为子元素,展示option内容时,会触发父元素的mouseleave,造成无法选中发情况
                $(document.body).on("mouseover", "select", function (event) {
                    event.stopPropagation();
                })
                $(document.body).on("mouseout", "select", function (event) {
                    event.stopPropagation();
                })
                $(document.body).on("change", "select", function (event) {
                    $(this).parents("[hex-eidtstate]").trigger("mouseleave");
                })
            }
        }
  • 相关阅读:
    那些年搞不懂的多线程、同步异步及阻塞和非阻塞(一)---多线程简介
    java中IO流详细解释
    Java IO流学习总结
    MySQL数据库中索引的数据结构是什么?(B树和B+树的区别)
    使用Redis存储Nginx+Tomcat负载均衡集群的Session
    Redis 3.2.4集群搭建
    JDK1.8源码分析之HashMap
    java HashMap和LinkedHashMap区别
    Java中原子类的实现
    多线程-传统定时任务
  • 原文地址:https://www.cnblogs.com/sanqianjin/p/8056637.html
Copyright © 2020-2023  润新知