• 使用layer.tips实现鼠标悬浮时触发事件提示消息实现


    代码:

    <body>
        <label id="test" onmouseover="show('test')">
            你瞅啥!?过来试试!
        </label>
    </body>
    

    方法一:

    <script>
    	function show(id) {
    	    layer.tips("左边么么哒", "#"+id+"", {
      		  tips: [4, "#4794ec"]
      		});
    	}
    </script>
    

    实现效果:

      如图所示,当鼠标悬浮在label标签范围内时,通过layer.tips弹出提示消息。其中tips:中设置为4,表示左边有空间时在左边弹出消息框;

      也可设置为其它:

        1——上方;2——右方;3——方;

      详情可查看:https://www.layui.com/doc/modules/layer.html#tips

    方法二:(通过过滤器去筛选)

    $("label").not(":last").mouseover(function() {
        		layer.tips($(this).text(), this, {
       	          tips: [3, "#4794ec"]
       	        });
        	});
    

     其中 .not(":last") 表示排除最后一个,整体意思是:除过最后一个label标签外的其他所有label标签。

  • 相关阅读:
    A good habit is half done
    mysql 练习题
    管理的实践
    mysql 表关联时执行顺序
    python 实现短信轰炸
    python django码云第三方登录
    mysql事务的隔离级别
    微服务
    什么是git
    如何使用Hexo创建博客
  • 原文地址:https://www.cnblogs.com/Big-Boss/p/9531235.html
Copyright © 2020-2023  润新知