天天看点

layer tips的偏移设置

最近使用layer.tips的时候,需要在一个i标签的icon上显示,打开发现显示位置不对。大概是下面这个图片的样子。

layer tips的偏移设置

layer的offset属性在tips里面不生效,最后成功用下面的代码修改了位置

layer.tips('请根据实际情况改正!', $(".icon-help-circle"),{
                tips: 1,
                time:3000,
                success: function (layero, index) {
                    var oldLeft = layero.css("left");
                    oldLeft = oldLeft.substring(0,oldLeft.indexOf('px'));
					layero.css("left", (oldLeft-10)+'px');
				}
            });
           

需要修改别的位置的,打个断点,看看layero里的信息,都能改。

继续阅读