Making a method in a plugin accessible globally?
<p>Given the jQuery dropdown plugin below. Is there a way to add a method that would allow for a separate function outside of the dropdown to 'hideMenu'? Thanks</p>

<p>For example, if I applied the plugin to a div with an ID like so: </p>

<pre><code>$('#settings.dropdown').dropDownMenu();
</code></pre>

<p>How could I then call to close the dropDownMenu w hideMenu from outside of the plugin? Thanks</p>

<pre><code>jQuery.fn.dropDownMenu = function() {

    // Apply the Dropdown
    return this.each(function() {

        var dropdown = $(this),
            menu = dropdown.next('div.dropdown-menu'),
            parent = dropdown.parent();

        // For keeping track of what's "open"
        var activeClass = 'dropdown-active',
            showingDropdown = false,
            showingMenu,
            showingParent,
            opening;

        // Dropdown Click to Open
        dropdown.click(function(e) {

            opening = true; // Track opening so that the body click doesn't close. This allows other js views to bind to the click
            e.preventDefault();

            if (showingDropdown) {
                dropdown.removeClass(activeClass);
                parent.removeClass(activeClass);
                showingMenu.hide();
                showingDropdown = false;
            } else {
                showingDropdown = true;
                showingMenu = menu;
                showingParent = parent;
                menu.show();
                dropdown.addClass(activeClass);
                parent.addClass(activeClass);
            }
        });

        // When you click anywhere on the page, we detect if we need to blur the Dropdown Menu
        $('body').click(function(e) {       
            if (!opening &amp;&amp; showingParent) {
                var parentElement = showingParent[0];

                if (!$.contains(parentElement, e.target) || !parentElement == e.target) {
                    hideMenu();
                }
            }

            opening = false;

        });

        // hides the current menu
        var hideMenu = function() {
            if(showingDropdown) {
                showingDropdown = false;
                dropdown.removeClass(activeClass);
                parent.removeClass(activeClass);
                showingMenu.hide();
            }
        };

    });

};
</code></pre>
