0
我有一個菜單,有一些按鈕(錨點)。
我希望當某個按鈕被按下時,div元素將出現在幻燈片動畫中。
我也希望當用戶將鼠標懸停在另一個按鈕上時,div元素會將自己隱藏在動畫中。
問題是,如果我將鼠標快速移動到其他元素上,隱藏動畫會重複多次。 下面的代碼:
使用Javascript/jQuery的:jQuery UI動畫問題
$(document).ready(function() {
$("#shiurButton").click(function(event) {
//Shows the div element
$(".shiurPicker").toggle('slide', {direction:'right'}, 1000);
});
$("#testButton").mouseover(function(event){
if ($(".shiurPicker").is(":visible")){
$(".shiurPicker").hide('slide', {direction:'right'}, 1000);
}
});
$("#dictionaryButton").mouseover(function(event) {
if ($(".shiurPicker").is(":visible")){
$(".shiurPicker").hide('slide', {direction:'right'}, 1000);
}
});
$("#helpButton").mouseover(function(event) {
if ($(".shiurPicker").is(":visible")){
$(".shiurPicker").hide('slide', {direction:'right'}, 1000);
}
});
});
任何想法?
謝謝
@Neal謝謝,但它不」工作 - 它仍然有問題。 – amitairos
@amitairos - 嘗試使用'animate'而不是'hide'或'toggle' – Neal
@Neal如何做到使用動畫向右滑動? – amitairos