Trying to create ExpandCollapse as its own Module and Standalone JS file
<p>How to create this ExpandCollapse.js shown below  <strong>as its own Module and standalone JS</strong> file? I would like to <strong>invoke it from a separate file that’s loaded on the page</strong>. It's just that i want the javascript file to be in object oriented fashion. Hope someone can walk me through the process.</p>

<pre><code>YUI().use('anim', function (Y) {
var onClick = function (e) {
        var expandAnswer = e.currentTarget.next('.expand');
        e.currentTarget.toggleClass('open');
        var content = new Y.Anim({
            node: expandAnswer,
            from: {
                height: 1
            },
            to: {
                height: function (node) { // dynamic in case of change
                    return node.get('scrollHeight'); // get expanded height 
                }
            },

            easing: Y.Easing.easeOut,
            duration: 0.5
        }).set('reverse', !e.currentTarget.hasClass('open')).run(); 
    };
Y.all('.questions_subdiv &gt; div ').on('click', onClick);});    
</code></pre>
