title: How to toggle class using jquery if else statement?
body: <p>I want to toggle class using jquery If Else statement for specified conditions.</p>
  
  <p>My Html with default css <code>class="horizontal"</code></p>
  
  <pre><code>&lt;div id="foo-bar"  class="my-item horizontal"&gt; 
  &lt;/div&gt;
  </code></pre>
  
  <p>Now How can I shuffle my css class between <code>horizontal</code> and <code>vertical</code> using jquery where <code>var=mayvar</code> as condition.</p>
  
  <pre><code>myvar may be layout1 or layout2.
  </code></pre>
  
  <p>for <code>myvar=layout1</code> <code>class="horizontal"</code>
  and for <code>myvar="layout2 class="vertical"</code></p>
  
  <p>and how to write the jquery if there are more than two condition for more different css classes?</p>