Author Topic: Can someone help me with some JS code please?  (Read 7877 times)

dukesanj

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
Can someone help me with some JS code please?
« on: May 20, 2011, 12:44:33 pm »
Hello!
Could someone please help me with some Js code?
I need to implement more than one gallery on a page, and the current script only allows one gallery.
Can someone please let me know if they can show me how to change the script to allow 10+ galleries on a page please?

Here's a copy of the script:
<script type="text/javascript" src="jquery/jquery-1.4.1.js"></script>

</script>

   <script type="text/javascript">
   var currentImage;
    var currentIndex = -1;
    var interval;
    function showImage(index){
        if(index < $('.bigPic img').length){
           var indexImage = $('.bigPic img')[index]
            if(currentImage){   
               if(currentImage != indexImage ){
                    $(currentImage).css('z-index',2);
                    clearTimeout(myTimer);
                    $(currentImage).fadeOut(500, function() {
                   myTimer = setTimeout("false", 3000);
                   $(this).css({'display':'none','z-index':1})
               });
                }
            }
            $(indexImage).css({'display':'block', 'opacity':1});
            currentImage = indexImage;
            currentIndex = index;
            $('.thumbs li').removeClass('active');
            $($('.thumbs li')[index]).addClass('active');
        }
    }
   
    function showNext(){
        var len = $('.bigPic img').length;
        var next = currentIndex < (len-1) ? currentIndex + 1 : 0;
        showImage(next);
    }
   
    var myTimer;
   
    $(document).ready(function() {
       myTimer = setTimeout("false()", 3000);
      showNext(); //loads first image
        $('.thumbs li').bind('click',function(e){
           var count = $(this).attr('rel');
           showImage(parseInt(count)-1);
        });
   });
   
   
   </script>   


And heres the url for the page:
http://www.innov8graphics.com/clients/jara/proyectos.html

I would really appreciate someones help.
Many thanks

Sanjay
sanjm74{at}yahoo{dot}{co}{dot}{uk}

 

palmate