我想在我的网站上使用由 Jquery 动画制作的小帮助框。一切都很好,但是当我快速进出盒子时,它开始像疯了一样躲藏起来。有什么办法可以停止功能隐藏框?这是我的帮助框:http: //jojo.i-web.sk/test/box.php
这是代码:
<body>
<center>!!LOOK AT DOWN RIGHT CORNER!!</center>
<div id="help-box">
<div id="help_sipka">
<<
</div>
<div id="help_problem_nadpis">
<h1>Do you have problem?</h1>
Click here.
</div>
<div id="help_problem_button">
<div style="float:right;"><acronym title="Zatvoriť"><input id="help_zavri" class="button_zavri" type="button" value="X"></acronym></div>
<h1>Do you have problem?</h1>
Have you lost password or found bug? Do you need help<br>
We can help you.<br>
Send mail to our admins.<br>
<input class="button_odosli" type="button" name="posli_mail" value="Send mail">
</div>
</div>
<script type="text/javascript">
$(function() {
var help_finished=1;
$('#help-box').mouseenter(function(){
if(help_finished!=2) {
help_finished=1;
$('#help-box').animate({width:'200'});
$('#help_sipka').delay(500).slideUp();
$('#help_problem_nadpis').delay(500).slideDown();
}
});
$('#help-box').mouseleave(function(){
if (help_finished ==1) {
setTimeout(hide_box, 500);
help_finished=0;
}
});
function hide_box() {
if (help_finished==0||help_finished==3) {
$('#help_sipka').slideDown();
$('#help_problem_nadpis').slideUp();
$('#help-box').delay(300).animate({width:'30'});
}
}
$('#help_zavri').click(function(){
help_finished=3
$('#help_problem_button').slideUp();
$('#help-box').animate({opacity:'0.75'});
hide_box();
});
$('#help-box').click(function(){
if(help_finished!=3) {
help_finished=2;
$('#help-box').animate({opacity:'1'});
$('#help_problem_button').slideDown();
$('#help_problem_nadpis').slideUp();
}
});
});
</script>
</body>