어떤 이유로 나는 할당 된 기능을 수행하기 위해 버튼을 두 번 눌러야합니다. 두 번의 클릭 이벤트가 있다는 사실과 관련이 있습니까? 그러나 "$ (buttonNumber) .on ('click', function() '스크립트를 제거하면 이 함수를 여러 단추에 사용할 계획이므로 함수에 있어야합니다.버튼을 두 번 눌러 Function-jQuery를 수행해야합니다.
HTML :
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="css/style.css" />
<script type="text/javascript" src="test2.js"></script>
</head>
<body>
<button id="button1" onclick="nextSlide('#button1', '#1', '#2')">Hide it</button>
<p id="1">Hide this text</p>
<p id="2">Show this text</p>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
</body>
</html>
JS :
window.onload=function(){
$('#2').fadeOut(1);
};
function nextSlide(buttonNumber, hideDiv, showDiv) {
$(buttonNumber).on('click', function() {
$(hideDiv).hide("slide", 2000, function(){
$(showDiv).show("slide", 2000);
});
});
};
당신이 v1 및 JQuery와의 v2를 모두 포함 왜? 이것은 필요하지 않습니다. 하나를 제거하고 문제가 지속되는지 확인하십시오. – nietonfir
그 중 하나는 슬라이드 기능에 필요한 jQuery UI 라이브러리입니다. – musha1
;-) 당신이 그것을 언급 했으니 까 ... : P는 4 번 소리를냅니다! – nietonfir