0
좋아요, 슬라이드 쇼가 작동하지만 이미지를 마우스로 가리키면 마우스를 인식하는 방법을 모르겠습니다.슬라이드 쇼를 가리켜 일시 중지하는 방법
자바 스크립트 :
<script type="text/javascript">
var hovering = false;
$('#slideshow').hover(function() { //not sure if #slideshow is the right thing to put here
hovering = true;
}, function() {
hovering = false;
slideShow();
});
$(document).ready(function(){
slideShow();
});
function slideShow() {
if(!hovering) {
var showing = $('#slideshow .show');
var next = showing.next().length ? showing.next() : showing.parent().children(':first');
var timer;
showing.fadeOut(500, function() { next.fadeIn(200).addClass('show'); }).removeClass('show');
setTimeout(slideShow, 3000);
}
}
</script>
HTML : 그것을 위해
<div id="slideshow">
<img class="show" src="../images/food/chicken_quesa.jpg">
<img src="../images/food/beet_salad.jpg">
<img src="../images/food/pasta_display.jpg">
</div>
이미지가 나타나지도 않습니다. –
id를 올바르게 입력하십시오. – Amrendra