PitPik / tinyColorPicker

Tiny jQuery color picker for mobile and desktop with alpha channel
http://www.dematte.at/tinyColorPicker/
MIT License
276 stars 77 forks source link

jQuery.fn.offset() requires a valid DOM element #88

Open Daijobou opened 4 years ago

Daijobou commented 4 years ago

Line https://github.com/PitPik/tinyColorPicker/blob/master/jqColorPicker.js#L306 call function toggle() without a DOM element, but in toggle() you catch always $this.offset() of $this = $(this) which not exists. Line https://github.com/PitPik/tinyColorPicker/blob/master/jqColorPicker.js#L83

You get this, when you close a tinycolorpicker popup with click on the website.

maybe change line 83 to position = $this.length ? $this.offset() : null, could be a solution or put var position in if (event) block, there you only need it.