0
안녕하세요 jQuery 이미지 crossfade 설정에 문제가 있습니까? http://tips.techmatemn.com/jQuery Image Crossfade가 작동하지 않습니다.
HTML
<div class="hero-cycler">
<img class="active" alt="Tips qualified Client 1" src="<?php bloginfo('stylesheet_directory'); ?>/assets/img/hero-bk-1.jpg">
<img alt="Tips qualified Client 2" src="<?php bloginfo('stylesheet_directory'); ?>/assets/img/hero-bk-2.jpg">
</div>
CSS
.hero-cycler{position:relative;}
.hero-cycler img{position:absolute;z-index:1}
.hero-cycler img.active{z-index:3}
SCRIPT
<script> // homepage client images
function cycleImages(){
var $active = $('.hero-cycler .active');
var $next = ($active.next().length > 0) ? $active.next() : $('.hero-cycler img:first');
$next.css('z-index',2);//move the next image up the pile
$active.fadeOut(1500,function(){//fade out the top image
$active.css('z-index',1).show().removeClass('active');//reset the z-index and unhide the image
$next.css('z-index',3).addClass('active');//make the next image the top one
});
}
$(document).ready(function(){
// run every 7s
setInterval('cycleImages()', 7000);
})
</script>
감사합니다!
뭐가 보이니? 정확히 작동하지 않는 것은 무엇입니까? 어떤 오류가 있습니까? 또한 두 이미지 사이를 순환하는 경우이 작업을 크게 단순화 할 수 있습니다. – DBS
일단 우리가이 작업을하면 더 많은 이미지를 갖게 될 것입니다. 나는 첫 번째 이미지를 본다. 내 생각 엔 이미지가 순환되지 않기 때문에 스크립트가 작동하지 않는 것입니다. – angeladesign
브라우저 콘솔에서 오류를 확인하십시오. 항상 시작하는 것이 좋습니다. 나는 이것을 바이올린에 집어 넣고 무슨 일이 일어나는지 보게 될 것이다. – DBS