zoukankan      html  css  js  c++  java
  • layer.tips自定义位置

    
    function Definitionlayertips(msg, obj, classObj) {//msg提示信息,obj当前元素,classObj吸附滚动的容器
        obj[0].scrollIntoView({behavior: "instant", block: "center", inline: "nearest"});
        layer.tips(msg, obj, {
            tipsMore: true,
            tips: 2,
            success: function (layero, index) {
                //需要吸附滚动的有滚动条的那个容器
                var domParent = classObj;
                //滚动条当前顶部距离
                var scrollTop = domParent[0].scrollTop;
                var widthTips = domParent[0].scrollWidth - (obj.offset().left + obj[0].scrollWidth);
                widthTips = widthTips>110?110:widthTips;
                //当前 tips 的top + 滚动条的顶部距离 + 容器的顶部距离(如:48)为新的top
                layero.css("top", layero.offset().top + 1 + scrollTop);
                layero.css("left", obj.offset().left + obj[0].scrollWidth + 20);
                layero.css("width", widthTips + 'px');
                $(layero).find("i").css("right",parseInt($(layero).find("i").css("right").split("px")[0]) + widthTips);
                domParent.append(layero);
            }
        });
    }
    
  • 相关阅读:
    12.1
    11.26
    12.5Java日报
    11.25
    11.27
    12.03
    11.28
    12.04
    如何在TortoiseGit中使用sshkeygen生成的key
    leetcode 39 组合总和
  • 原文地址:https://www.cnblogs.com/yu-du-chen/p/12119942.html
Copyright © 2011-2022 走看看