third: Add option for which container to append the color picker to.

This allows you to select the container that the color picker should
append to and therefore be absolutely positioned in accordance with.

This still defaults to document body, which was the previously default
container to append the color picker to.
This commit is contained in:
Brock Whittaker 2016-08-09 03:12:11 -07:00 committed by Tim Abbott
parent 77aa43fffb
commit eda1cdd0c5
1 changed files with 5 additions and 2 deletions

View File

@ -32,7 +32,10 @@
showAlpha: false, showAlpha: false,
theme: "sp-light", theme: "sp-light",
palette: ['fff', '000'], palette: ['fff', '000'],
selectionPalette: [] selectionPalette: [],
// user-specified container
container: null
}, },
spectrums = [], spectrums = [],
IE = !!/msie/i.exec( window.navigator.userAgent ), IE = !!/msie/i.exec( window.navigator.userAgent ),
@ -165,7 +168,7 @@
draggingClass = "sp-dragging"; draggingClass = "sp-dragging";
var doc = element.ownerDocument, var doc = element.ownerDocument,
body = doc.body, body = opts.container || doc.body,
boundElement = $(element), boundElement = $(element),
container = $(markup, doc).addClass(theme), container = $(markup, doc).addClass(theme),
dragger = container.find(".sp-color"), dragger = container.find(".sp-color"),