Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $('.chosen-select').chosen({}).change(function (obj, result) {
- console.debug("changed: %o", arguments);
- console.log("selected: " + result.selected);
- });
- (function () {
- // hold onto the drop down menu
- var dropdownMenu;
- // and when you show it, move it to the body
- $(window).on('chosen:showing_dropdown', function (e) {
- // grab the menu
- dropdownMenu = $(e.target).next('.chosen-container').find('.chosen-drop');
- // detach it and append it to the body
- $('body').append(dropdownMenu.detach());
- // grab the new offset position
- var eOffset = $(e.target).offset();
- // make sure to place it where it would normally go (this could be improved)
- dropdownMenu.css({
- 'top': eOffset.top + $(e.target).outerHeight(),
- 'left': eOffset.left
- });
- });
- // and when you hide it, reattach the drop down, and hide it normally
- $(window).on('chosen:hiding_dropdown', function (e) {
- $(e.target).next('.chosen-container').append(dropdownMenu.detach());
- });
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement