onmousedown 이벤트를 사용하여 링크를 클릭하면 두 번 클릭하여 전환 할 수 있습니다. 나는 이것이 왜 그렇게 중요한지 이해하지 못하고있다. 이것이 내가 실망 오류를받지 못했습니다토글은 두 번 클릭했을 때만 작동합니다.
<div class ="interactionLinksDiv">
<a href="#" onclick="return false" onmousedown="toggleInteractContainers('add_friend');">Add Contact</a>
</div>
<div class ="interactContainers" id ="add_friend">
<div align ="right"><a href="#" onclick= "return false" onmousedown = "toggleInteractContainers('add_friend')">cancel</a></div>
Add as a contact?
<a href ="#" onclick="return false" onmousedown="javascript:addAsFriend(); ">Yes</a>
</div>
를 div에에서
function toggleInteractContainers(x) {
//the 'x' variable represents the add friend/message container value
if($('#'+x).is(":hidden")) {
//if the container is hidden then we will slide it down and show it
$('#'+x).slideToggle(400);
} else {
//if its not being hidden then we will hide it
$('#'+x).hide();
}
//this just means we have to hide all the containers
$('.interactContainers').hide();
}
는 내가 전화 드렸습니다. 왜 이런 일이 일어 났으며 내가 다시 일어나는 것을 막기 위해 할 수있는 일을 말하면 크게 감사 할 것입니다. 길을 따라가는 프로그래밍 팁도 훌륭합니다.
스크립트가 모두 작동을 중지 원인에 맞는 희망 @cale_b – Octavius