https://bugzilla.wikimedia.org/show_bug.cgi?id=32731

--- Comment #1 from Dan Barrett <mediaw...@blazemonger.com> 2012-01-12 16:40:23 
UTC ---
The problem lines are in jquery.wikiEditor.toolbar.js:

$select.append( $( '<a/>' )
                .addClass( 'label' )
                .text( label )
                .data( 'options', $options )
                .attr( 'href', '#' )
                .mousedown( function( e ) {
                    // No dragging!
                    e.preventDefault();
                    return false;
                } )
                .click( function( e ) {
                    $(this).data( 'options' ).animate( { 'opacity': 'toggle' },
'fast' );
                    e.preventDefault();
                    return false;
                } )
              );

A JavaScript developer friend recommends adding a second click handler
immediately after the first, but on the document object, that closes the
dropdown. He submitted this code, which doesn't quite work (the events are
bubbling up when they shouldn't) but maybe will be helpful to you:

.click(function(e) {
    var $menu = $(this).data('options');
    $menu.animate({'opacity': 'toggle'}, 'fast');
    // Assign a click handler to the document to close
    var documentOnClick = function(e) {
        if (!$(e.target).parents().is($menu)) {
            $menu.animate({'opacity': 'toggle'}, 'fast');
        }
        // Self-destruct: remove this handler
        $(document).unbind('click', documentOnClick);
    };

    $(document).bind('click', documentOnClick);

    e.preventDefault();
    return false;
})

Hope this helps.

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to