在 div 后面画黑点

Make black dot behind around div

我实施了 Spectrum Color Picker. There is a slight change I want to make. The black dot that you can drag to select a color, the class name is sp-dragger. I want to edit the source file 这样当您将黑点一直拖到侧面时,(顶部、右侧、底部和左侧)任何来自 class 名称边框的内容sp-color 等等,应该隐藏黑点。

(图片来自 Adob​​e Illustrator)

我认为这样做的方法是创建一个 div,或使用现有的 div,并使 z-index 高于黑点。

JSFiddle

JavaScirpt Source

CSS Source

在 css 来源中查找此部分:

.sp-color {
    position: absolute;
    top:0;
    left:0;
    bottom:0;
    right:20%;

   /* Then add this line */
   overflow: hidden;
}

因此内容不会超出其边缘。