jquery 자동 탭인데요.. 마우스 올리면 갑자기 빠르게 돌아갑니다..

정상적으로 작동 하는 소스인데..
탭메뉴에 마우스 올리고 가만히 놔두면 메인이미지들이 미친듯이 돌아갑니다..
어딜 수정해야 하는지 고수님들 도움을 부탁드립니다..

<script>
//메인 베스트오브베스트
var Loadn = 1;
function bob(n) {
for(var i = 1; i < 5; i++) {
obj = document.getElementById('bob'+i);
img = document.getElementById('bob_button'+i);
if ( n == i ) {
obj.style.display = "block";
img.src = "/images/main/bob0"+i+"_on.gif";
} else {
obj.style.display = "none";
img.src = "/images/main/bob0"+i+"_off.gif";
}
}
Loadn++;
if(Loadn ==5){
Loadn =1;
}
setTimeout("bob("+Loadn+")",1000); //1000 = 1초
}
</script>
<!-- 베스트오브 베스트 시작 -->
<table width="990" border="0" cellspacing="0" cellpadding="0" style="border-bottom: 2px solid #757575;">
<tr>
<td width="200"><img src="/images/main/title_md.gif" alt="" /></td>
<td width="790" align="right" valign="bottom"><span style="cursor: pointer;">
<div id='bob_button1' onclick='bob(1);' onmouseover='bob(1);'>첫번째</div>
<div id='bob_button2' onclick='bob(2);' onmouseover='bob(2);'>2번째</div>
<div id='bob_button3' onclick='bob(3);' onmouseover='bob(3);'>3번째</div>
<div id='bob_button4' onclick='bob(4);' onmouseover='bob(4);'>4번째</div>
</span></td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>

<table width="990" border="0" align="center" cellpadding="0" cellspacing="0" id='bob1' style='display:block;' >
<tr>
<td>내용1</td>
</tr>
</table>

<table width="990" border="0" align="center" cellpadding="0" cellspacing="0" id='bob2' style='display:block;' >
<tr>
<td>내용2</td>
</tr>
</table>

<table width="990" border="0" align="center" cellpadding="0" cellspacing="0" id='bob3' style='display:block;' >
<tr>
<td>내용3</td>
</tr>
</table>

<table width="990" border="0" align="center" cellpadding="0" cellspacing="0" id='bob4' style='display:block;' >
<tr>
<td>내용4</td>
</tr>
</table>
<script>bob(Loadn);</script>




아래와 같은 답변을 받았는데요...


마우스가 올라가면 멈추는 루틴이 없네요? settimeout구문은 bob 함수부분에서 빼서 돌리거나 함수 전체를 개선 하셔야 할듯 합니다. 해당 함수가 계속 돌아가면서 클릭이나 마우스 오버등으로 bob 구문을 불러오게 되면 계속 새로운 bob이 중첩으로 돌아가는것 같네요....


jquery 잘 아시는 분 계시면 조금만 도움을 부탁드립니다..
|

댓글 1개

아래부분 모두 제거해보세요
Loadn++;
if(Loadn ==5){
Loadn =1;
}
setTimeout("bob("+Loadn+")",1000); //1000 = 1초

그리고
Loadn =n;
댓글을 작성하시려면 로그인이 필요합니다.

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기 기존 게시물은 열람만 가능합니다.

+
제목 글쓴이 날짜 조회
13년 전 조회 2,264
13년 전 조회 783
13년 전 조회 701
13년 전 조회 775
13년 전 조회 1,018
13년 전 조회 751
13년 전 조회 1,546
13년 전 조회 967
13년 전 조회 756
13년 전 조회 1,531
13년 전 조회 1,120
13년 전 조회 842
13년 전 조회 955
13년 전 조회 767
13년 전 조회 769
13년 전 조회 982
13년 전 조회 950
13년 전 조회 3,386
13년 전 조회 965
13년 전 조회 749