jQuery - change value of css class dynamically
<p>I have an image slider written in jQuery. I need the images to be in groups of two (like a magazine) so i have classes .pageLeft and .pageRight that apply a left- or right-margin equal to the width of the container minus the width of a page img (.page class). I want to be able to fullscreen this slider and dynamically calculate and change the width of the .page and the margin value of the .pageLeft/.pageRight classes. Is there any way to do this, or am I going about this all wrong?</p>

<p>The best way I could think to do this would be to write the classes to the DOM directly, but then I would have to empty and add every time.</p>

<p>Here is an example of what I'm trying to say</p>

<pre><code>nPageWidth = 768;
nPageWidthPlusMargin = ($('#container').width() / 2);
nPageMargin = nPageWidthPlusMargin - nPageWidth;
</code></pre>

<p>and then use that value to change margin-left = nPageMargin for the class in the css.</p>

<p>Sorry if this is a confusing question. Thanks for your time.</p>

<p>EDIT: The main reason I'm trying to do it this way is to maintain the aspect ratio of the images by setting the width of the image to be 3:4 the height of the image which is set to 100% of the container.</p>
