js 调色板 纯js
function DisplayClrDlg(display) { var clrPanel = document.getElementById("colorpanel"); if (display) { var left = document.body.scrollLeft + event.clientX; var top = document.body.scrollTop + event.clientY; if (event.clientX+clrPanel.style.pixelWidth > document.body.clientWidth) { //对话框显示在鼠标右方时,会出现遮挡,将其显示在鼠标左方 left -= clrPanel.style.pixelWidth; } if (event.clientY+clrPanel.style.pixelHeight > document.body.clientHeight) { //对话框显示在鼠标下方时,会出现遮挡,将其显示在鼠标上方 top -= clrPanel.style.pixelHeight; } clrPanel.style.pixelLeft = left; clrPanel.style.pixelTop = top; clrPanel.style.display = "block"; } else { clrPanel.style.display = "none"; } } //对话框显示在鼠标下方时,会出现遮挡,将其显示在鼠标上方 top -= clrPanel.style.pixelHeight; } clrPanel.style.pixelLeft = left; clrPanel.style.pixelTop = top; clrPanel.style.display = "block"; } else { clrPanel.style.display = "none"; } }
用户评论
qqtidal45053 2018-12-28 16:20:06
简单好用,正好用到了,很不错
baidu_43756 2018-12-28 16:20:06
谢谢。简单实用,能用
qq_80401 2018-12-28 16:20:06
现在找个调色板都不容易了, 一般般吧
qqlargely58241 2018-12-28 16:20:06
还是有些地方需要完善,多谢楼主分享
APOLLO_TS 2018-12-28 16:20:06
感谢楼主分享,但是还是有点不太完善。学习了!
红色海湾 2018-12-28 16:20:06
很简单,很实用
qqtogether32388 2018-12-28 16:20:06
和我前面下载的另一个色板一样,不过很简单很实用。