use divs from array as jquery object
<p>I have a javascript class like this (i know it's technically not a class).</p>

<pre><code>function StackMedia (container) {

    this.container = container;
    this.items = container.find('.stackItem');
    console.log("this.items.length: "+this.items.length);

}
</code></pre>

<p>I pass a container (div) that holds other divs with the css class stackItem, those get stored in items.</p>

<p>Here i want to reuse it:</p>

<pre><code>StackMedia.prototype.updatePositions = function() {

     for (var i = 0; i &lt; this.items.length; i++) {
         this.items[i].css('left', 50);
    }
}
</code></pre>

<p>The problem is that it isn't a jquery object anymore so i get this error:</p>

<p><strong>TypeError: 'undefined' is not a function (evaluating 'this.items[i].css('left', 50)')</strong></p>

<p>How can i store them as a jquery object?</p>

<hr>

<p>update</p>

<p>Here is where i create the classes (works fine):</p>

<pre><code>// create a stack by passing a container
    $('.stackContainer').each(function(containerIndex) {
        $(this).css('z-index', containerIndex);
        stacks.push(new StackMedia($(this)));
    });
</code></pre>

<p>This is almost fine apart from the last line</p>

<pre><code>StackMedia.prototype.updatePositions = function() {

    var sm = this; // StackMedia

    // set the css properties of the items
    this.items.each(function(i){
        $(this).css('left', sm.x + i * sm.overlapX);
        $(this).css('top', sm.y + i * sm.overlapY);
        $(this).css('width', sm.itemWidth);
        $(this).css('height', sm.itemHeight);
        $(this).find('img').css('width', sm.itemWidth);
        $(this).find('img').css('height', sm.itemHeight);
    });

    // set the css properties of the container
    //console.log(sm);
    console.log($(this));
    $(this).container.css('width', 400);

};
</code></pre>

<p>I get this again: <strong>TypeError: 'undefined' is not an object (evaluating '$(this).container.css')</strong></p>

<p>So <code>$(this).container</code> lost it's jquery functionality, how can i get it back?</p>
