zoukankan      html  css  js  c++  java
  • 父子元素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");
                })
            }
        }
  • 相关阅读:
    python 给文件批量加‘“’ ”,"
    ubuntu 编译android 源码笔记
    ubuntu java 环境配置
    Android4.4r1(KitKat)源码下载地址
    android 学习视频汇总
    Java 注解
    Linux 索引节点(inode)详解
    系统启动
    Win7、Ubuntu双系统正确卸载Ubuntu系统
    深入理解LInux内核-进程通信
  • 原文地址:https://www.cnblogs.com/sanqianjin/p/8056637.html
Copyright © 2011-2022 走看看