테스트 사이트 - 개발 중인 베타 버전입니다

부드럽게 자동 전환되는 이미지 소스 채택완료

바오밥 10년 전 조회 9,428

안녕하세요?

이미지 5개 정도가 부드럽게 자동으로 전환될수 있는 소스나 방법을 구합니다.

아시는 분 계시면 도움주시면 감사하겠습니다.

링크는 필요없고 그냥 자동으로 페이드인-아웃 되면서 부드럽게 전환되면 좋겠습니다.

 

수고하세요~~ 

댓글을 작성하려면 로그인이 필요합니다.

답변 2개

채택된 답변
+20 포인트
p
10년 전

</p><p><!doctype html></p><p><html>
<head>
<meta charset="utf-8">
<title> fadeInOut 갤러리 </title>
<code class="snippet"><script      src="<a href="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js" target="_blank" rel="noopener noreferrer">https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js</a>"></script></code> 
<style>
body {
 margin:20px auto;
 padding:0; 
 width:620px;
 background:#192839;
}
.fadeShow { 
 background:#666;
 width:600px; 
 height:350px; 
 border:2px solid #FDF6DD;        
}
.fadeShow img{position:absolute;}</p><p>.fadeShow .active{
    z-index:1;
}
 
</style>
</head></p><p><body></p><p><div class="fadeShow">
     <img class="active" src="slide1.jpg" alt="image1" />
     <img src="slide2.jpg" alt="image2" />
     <img src="slide3.jpg" alt="image3" />
</div></p><p>
<!---------- jQuery code Start ---------->
<script>
var showImg, nextImg;</p><p>function fadeInOut(){
   
   showImg = $(".fadeShow img:eq(0)");
   nextImg = $(".fadeShow img:eq(1)");
   nextImg.addClass("active");
   nextImg.css("opacity","0")
    .animate({opacity:1},1000, function() {     
         $(".fadeShow").append( showImg );  
      showImg.removeClass("active");  
    });
}
var timer = setInterval("fadeInOut()",3000);</p><p>$("div.fadeShow").hover( 
    function() {
    clearInterval(timer)
 }, 
 function(){
    timer = setInterval("fadeInOut()",2000);
    }
);
</script>
</body>
</html></p><p>

이 코드를 이용해서 적용해 보세요. 

이미지 파일명과 경로, 크기(widthl, height)값은 이미지에 맞게 수정하시면 되겠습니다.

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

구글에서 " jquery 슬라이드 " 검색해보세요
로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인