(function ($) {
    $.fn.dropdown = function () {
        this.on('click', function (e) {
            $(this).transitionEffect();
        })
        $(document).on('click', function (event) {
            console.log($(event.target).closest(".dropdown").length);
            if ($(event.target).closest(".dropdown").length === 0) {
                $('.dropdown').each(function () {
                    $(this).transitionEffect({state: 'leave'});
                });
            }
        });
    }
}(jQuery))