Jump to content
php.lv forumi
  • 0

Slideshow teksta maiņa


mypoint

Question

Pievienoju sev lapā ŠO slideshow, bet lieta tāda ka vēlos lai līdz ar bildēm nomainas teksts zem tām.

 

	<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(250, function() {
				    myTimer = setTimeout("showNext()", 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("showNext()", 3000);
	showNext(); //loads first image
       $('#thumbs li').bind('click',function(e){
       	var count = $(this).attr('rel');
       	showImage(parseInt(count)-1);
       });
});


</script>

 

			<div id="bigPic">
			<img src="imgs/1.jpg" alt="" />
			<img src="imgs/2.jpg" alt="" />
			<img src="imgs/3.jpg" alt="" />
			<img src="imgs/4.jpg" alt="" />
			<img src="imgs/5.jpg" alt="" />
			<img src="imgs/6.jpg" alt="" />
			<img src="imgs/7.jpg" alt="" />
			<img src="imgs/8.jpg" alt="" />
			<img src="imgs/9.jpg" alt="" />
			<img src="imgs/10.jpg" alt="" />
		</div>


		<ul id="thumbs">
			<li class='active' rel='1'><img src="imgs/1_thumb.jpg" alt="" /></li>
			<li rel='2'><img src="imgs/3_thumb.jpg" alt="" /></li>
			<li rel='3'><img src="imgs/4_thumb.jpg" alt="" /></li>
			<li rel='4'><img src="imgs/5_thumb.jpg" alt="" /></li>
			<li rel='5'><img src="imgs/6_thumb.jpg" alt="" /></li>
			<li rel='6'><img src="imgs/7_thumb.jpg" alt="" /></li>
			<li rel='7'><img src="imgs/8_thumb.jpg" alt="" /></li>
			<li rel='8'><img src="imgs/9_thumb.jpg" alt="" /></li>
			<li rel='9'><img src="imgs/10_thumb.jpg" alt="" /></li>
			<li rel='10'><img src="imgs/2_thumb.jpg" alt="" /></li>
		</ul>

Edited by mypoint
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...