Libraryless. Click here for Pure Java version (3197L/18K).
sS hjs_selectizeClickable() { ret hjs([[ Selectize.define('clickable', function(options) { var self = this; var setup = self.setup; this.setup = function() { setup.apply(self, arguments); var clicking = false; // Detect click on a .clickable self.$dropdown_content.on('mousedown click', function(e) { if ($(e.target).hasClass('clickable')) { if (e.type === 'mousedown') { clicking = true; self.isFocused = false; // awful hack to defuse the document mousedown listener } else { self.isFocused = true; setTimeout(function() { clicking = false; // wait until blur has been preempted }); } } else { // cleanup in case user right-clicked or dragged off the element clicking = false; self.isFocused = true; } }); // Intercept default handlers self.$dropdown.off('mousedown click', '[data-selectable]').on('mousedown click', '[data-selectable]', function() { if (!clicking) { return self.onOptionSelect.apply(self, arguments); } }); self.$control_input.off('blur').on('blur', function() { if (!clicking) { return self.onBlur.apply(self, arguments); } }); } }); ]]); }
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx
No comments. add comment
| Snippet ID: | #1031862 | 
| Snippet name: | hjs_selectizeClickable - allow links inside of dropdowns using class "clickable" | 
| Eternal ID of this version: | #1031862/3 | 
| Text MD5: | 97bc490ea9da0f2cbbc03dee1966536a | 
| Transpilation MD5: | 08b571ba98b98d6bb73b296e2bcdc76c | 
| Author: | stefan | 
| Category: | javax | 
| Type: | JavaX fragment (include) | 
| Public (visible to everyone): | Yes | 
| Archived (hidden from active list): | No | 
| Created/modified: | 2021-07-20 15:14:46 | 
| Source code size: | 1608 bytes / 43 lines | 
| Pitched / IR pitched: | No / No | 
| Views / Downloads: | 379 / 475 | 
| Version history: | 2 change(s) | 
| Referenced in: | [show references] |