[英]Smooth menu appearing
我想制作一個從右向左滑動的菜單 h2 header以及完成時從上到下的信息。 如果菜單已經存在,如果單擊不同的選項,則首先上升然后離開,否則如前所述。 所以主要問題是在某些方面需要出現 2 個信息而不是一個信息,我不知道該怎么做,所有信息都一個接一個地執行。 如果使用回調,某些文本會出現兩次或更多次......
$("a[rel~='showinfo']").click(function () {
var info_id = $(this).attr('id');//getting needed id from menu to show info
if($('.info_name').is(':visible'))//if already exists - removing
remove_contact();
for(i=0; i<contact_status.length; i++){//checking all array for item
if(info_id == contact_status[i]){//if item exist
create_contact(i);//putting it in
//here starts problems....
$('#info_name'+i).show("slide", {direction: "right"}, 1000, function(){
$('#info_info'+i).show("slide", {direction: "up"}, 1000);
});
}
}
//$('.info_name').show("slide", {direction: "right"}, 1000);
//$('.info_info').show("slide", {direction: "up"}, 1000);
});
function create_contact(id){
$('.third').append('<div class="showinfo"><h2 id="info_name'+id+'" class="info_name">'+contact_name[id]+'</h2><span class="info_info" id="info_info'+id+'">lol</span></div>')
}
function remove_contact() {
$('.info_name').hide("slide", {direction: "right"}, 1000);
$('.showinfo').remove();
}
for(i=0; i<contact_status.length; i++){//checking all array for item
if(info_id == contact_status[i]){//if item exist
(function ( idx ) { // use a Anonymous funciton
create_contact(idx );//putting it in
//here starts problems....
var;
$('#info_name'+idx ).show("slide", {direction: "right"}, 1000, function(){
$('#info_info'+idx ).show("slide", {direction: "up"}, 1000);
});
})( i );
}
}
啊,我錯了……這次應該是對的
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.