Autorotate divs with jQuery
<pre><code>&lt;script type="text/JavaScript"&gt;
$(document).ready(function (){
    $('#button a').click(function(){
        var integer = $(this).attr('rel');
        $('#myslide .cover').animate({left:-160*(parseInt(integer)-1)})  /*----- Width of div mystuff (here 160) ------ */
        $('#button a').each(function(){
        $(this).removeClass('active');
            if($(this).hasClass('button'+integer)){
                $(this).addClass('active')}
        });
    });
});
&lt;/script&gt;
</code></pre>

<p>HTML:</p>

<pre><code>&lt;div id="button"&gt;
         &lt;a class="button1 active" rel="1" href="#"&gt;&lt;/a&gt;
         &lt;a class="button2" rel="2" href="#"&gt;&lt;/a&gt;
         &lt;a class="button3" rel="3" href="#"&gt;&lt;/a&gt;
    &lt;/div&gt; &lt;!-- end of div button--&gt;

    &lt;div class="clear"&gt;&lt;/div&gt;

    &lt;div id="myslide"&gt;
        &lt;div class="cover"&gt;

            &lt;div class="mystuff"&gt;
                Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas pharetra, elit sed hendrerit condimentum, libero elit tincidunt mauris, id rutrum tellus leo at urna. Fusce dui mi, lacinia sit amet blandit vitae, interdum ut eros. Nulla egestas imperdiet rutrum. Praesent vel metus ligula. In ut leo enim, in interdum urna. In hac habitasse platea dictumst. Nullam euismod, eros et venenatis adipiscing, libero libero cursus magna, et semper tellus ipsum eget libero.
            &lt;/div&gt;
            &lt;div class="mystuff"&gt;
                Aenean scelerisque ipsum a nunc placerat sed blandit odio sollicitudin. Donec sed velit id ipsum lobortis tincidunt a sit amet leo. Praesent sit amet nisl a arcu lobortis egestas. Nunc at felis in erat condimentum ornare vel vel nisl. Phasellus ultrices nisi vel leo commodo et rhoncus ipsum porttitor. Fusce eu ligula sit amet sapien ullamcorper adipiscing. Suspendisse non ipsum elit. Nunc vehicula, felis non scelerisque aliquam, tellus leo consequat sem, ac suscipit nisi risus a justo. Quisque sollicitudin iaculis nisl at luctus. Curabitur porttitor lacus et dui blandit vulputate. In eu quam quam.
            &lt;/div&gt;
            &lt;div class="mystuff"&gt;
                Suspendisse iaculis sodales dui pretium faucibus. Praesent vitae ipsum justo, id tempor tellus. In nulla leo, dignissim quis luctus sed, commodo nec velit. Aliquam ac nisl quam, quis tincidunt magna. Aenean nec massa elit, non ornare neque. Vestibulum at ipsum sit amet augue euismod consequat. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vivamus porttitor gravida massa at cursus. Sed ac viverra risus.
            &lt;/div&gt;

        &lt;/div&gt; &lt;!-- end of div cover --&gt;
    &lt;/div&gt;  &lt;!-- end of div myslide --&gt;
</code></pre>

<p>Now its working when u pressings .button1, 2, etc. How to make it automatically? (autorotate)</p>
