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);
            }
        });
    }
    
  • 相关阅读:
    菜农大叔抢楼
    实验室博客
    VS2008加入QT
    9G关于新唐M0的ISP的要点
    内部函数和外部函数
    51串口通信
    一个三位整数反向后输出
    C++重载函数定义和用法
    博客记录
    C语言练习笔记更新
  • 原文地址:https://www.cnblogs.com/yu-du-chen/p/12119942.html
Copyright © 2011-2022 走看看