src/trumbowyg.js
function (name) {
            var t = this,
                d = t.doc,
                prefix = t.o.prefix,
                $dropdown = $('[data-' + prefix + 'dropdown=' + name + ']', t.$box),
                $btn = $('.' + prefix + name + '-button', t.$btnPane),
                show = $dropdown.is(':hidden');

            $('body', d).trigger('mousedown');

            if (show) {
                var o = $btn.offset().left;
                $btn.addClass(prefix + 'active');

                $dropdown.css({
                    position: 'absolute',
                    top: $btn.offset().top - t.$btnPane.offset().top + $btn.outerHeight(),
                    left: (t.o.fixedFullWidth && t.isFixed) ? o + 'px' : (o - t.$btnPane.offset().left) + 'px'
                }).show();

                $(window).trigger('scroll');

                $('body', d).on('mousedown.' + t.eventNamespace, function (e) {
                    if (!$dropdown.is(e.target)) {
                        $('.' + prefix + 'dropdown', t.$box).hide();
                        $('.' + prefix + 'active', t.$btnPane).removeClass(prefix + 'active');
                        $('body', d).off('mousedown.' + t.eventNamespace);
                    }
                });
            }
        }
function (name) {
            var t = this,
                d = t.doc,
                prefix = t.o.prefix,
                $dropdown = $('[data-' + prefix + 'dropdown=' + name + ']', t.$box),
                $btn = $('.' + prefix + name + '-button', t.$btnPane),
                show = $dropdown.is(':hidden');

            $('body', d).trigger('mousedown');

            if (show) {
                var o = $btn.offset().left;
                $btn.addClass(prefix + 'active');

                $dropdown.css({
                    position: 'absolute',
                    top: $btn.offset().top - t.$btnPane.offset().top + $btn.outerHeight(),
                    left: (t.o.fixedFullWidth && t.isFixed) ? o + 'px' : (o - t.$btnPane.offset().left) + 'px'
                }).show();

                $(window).trigger('scroll');

                $('body', d).on('mousedown.' + t.eventNamespace, function (e) {
                    if (!$dropdown.is(e.target)) {
                        $('.' + prefix + 'dropdown', t.$box).hide();
                        $('.' + prefix + 'active', t.$btnPane).removeClass(prefix + 'active');
                        $('body', d).off('mousedown.' + t.eventNamespace);
                    }
                });
            }
        }
function ( name ) { var t = this , d = t . doc , prefix = t . o . prefix , $dropdown = $ ( '[data-' + prefix + 'dropdown=' + name + ']' , t . $box ) , $btn = $ ( '.' + prefix + name + '-button' , t . $btnPane ) , show = $dropdown . is ( ':hidden' ) ; $ ( 'body' , d ) . trigger ( 'mousedown' ) ; if ( show ) { var o = $btn . offset ( ) . left ; $btn . addClass ( prefix + 'active' ) ; $dropdown . css ( { position : 'absolute' , top : $btn . offset ( ) . top - t . $btnPane . offset ( ) . top + $btn . outerHeight ( ) , left : ( t . o . fixedFullWidth && t . isFixed ) ? o + 'px' : ( o - t . $btnPane . offset ( ) . left ) + 'px' } ) . show ( ) ; $ ( window ) . trigger ( 'scroll' ) ; $ ( 'body' , d ) . on ( 'mousedown.' + t . eventNamespace , function ( e ) { if ( ! $dropdown . is ( e . target ) ) { $ ( '.' + prefix + 'dropdown' , t . $box ) . hide ( ) ; $ ( '.' + prefix + 'active' , t . $btnPane ) . removeClass ( prefix + 'active' ) ; $ ( 'body' , d ) . off ( 'mousedown.' + t . eventNamespace ) ; } } ) ; } }
Open dropdown when click on a button which open that
Open dropdown when click on a button which open that