View Single Post
Old 12-15-2012, 02:57 PM   PM User | #3
vwphillips
Senior Coder

 
Join Date: Mar 2005
Location: Portsmouth UK
Posts: 4,355
Thanks: 3
Thanked 458 Times in 445 Posts
vwphillips is a jewel in the roughvwphillips is a jewel in the roughvwphillips is a jewel in the rough
Code:
$(document).ready(function() {
 Next.lgth=8;
 Next.index=0;
 $("#nxt").click(function() {
  Next(1);
 });
 $("#bak").click(function() {
  Next(-1);
 });
 $("#cf7_controls").on('click', 'span', function() {
 $("#cf7 img").removeClass("opaque");
 Next.index = $(this).index();
 $("#cf7 img").eq(Next.index).addClass("opaque");
 $("#cf7_controls span").removeClass("selected");
 $("#cf7_controls span").eq(Next.index).addClass("selected");
});
});

function Next(ud){
 ud=Next.index+ud;
 ud=ud<0?Next.lgth:ud>Next.lgth?0:ud;
 $("#cf7 img").removeClass("opaque");
 $("#cf7 img").eq(ud).addClass("opaque");
 $("#cf7_controls span").removeClass("selected");
 $("#cf7_controls span").eq(ud).addClass("selected");
 Next.index=ud;
}
Code:
  <p id="cf7_controls">
<input id="bak" type="button" name="" value="Back" />
    <span class="selected">01</span>
    <span>02</span>
    <span>03</span>
    <span>04 </span>
    <span>05 </span>
    <span>06 </span>
    <span>07 </span>
    <span>08 </span>
    <span>09 </span>
<input id="nxt" type="button" name="" value="Next" />  </p>
    </p>
</div>
__________________
Vic

God Loves You and will never love you less.

http://www.vicsjavascripts.org.uk/

If my post has been useful please donate to http://www.operationsmile.org.uk/
vwphillips is offline   Reply With Quote
Users who have thanked vwphillips for this post:
samslystone (12-15-2012)