jQuery custom slider show or hide navigation buttons
<p>I have built a custom jQuery slider (I know about Cycle etc but want to use a custom one).</p>

<p>It allows a user to navigate a slider using both a pager and next and previous buttons which I have managed to get working.</p>

<p>However because my slider does not loop (intentional by design) I would like to hide and show the next and previous buttons when the user has reached the first or last slides.</p>

<p>To do this I have created a function that runs when a user clicks either a button or pager and checks what to show or hide. But this is where I'm stuck. Can anyone help?</p>

<p>This is the fiddle for the slider: <a href="http://jsfiddle.net/2WeMT/" rel="nofollow">http://jsfiddle.net/2WeMT/</a></p>

<p>The closest I have got working so far is:</p>

<pre><code>if ($('div.slideshow &gt; div:last').is(':visible')) {
                        $('.next').fadeOut();
                    } else {
                        $('.next').fadeIn();
                    } if ($('div.slideshow &gt; div:first').is(':visible')) {
                        $('.previous').fadeOut();
                    } else {
                        $('.previous').fadeIn();
                    }
</code></pre>

<p>But it doesn't show the correct buttons when in the middle pages and it sometimes gets confused and hides and shows the wrong buttons.</p>

<p>Also tried adding this to fix the middle page issue but again causes problems:</p>

<pre><code>if ($('div.slideshow &gt; div:visible').prev(':hidden')) {
                        $('.previous').fadeIn();
                    }
                    if ($('div.slideshow &gt; div:visible').next(':hidden')) {
                        $('.next').fadeIn();
                    }
</code></pre>
