// Lee dialog 1.0 http://www.xij.cn/blog/?p=68 var dialogFirst=true; function leeDialog(title,content,width,height,cssName){ if(dialogFirst==true){ var temp_float=new String; temp_float="
"; temp_float+="
"; temp_float+="

¹Ø±Õ
"; temp_float+="
"; temp_float+="
"; $("body").append(temp_float); dialogFirst=false; } $("#floatBox .title span").click(function(){ $("#floatBoxBg").hide(); $("#floatBox").hide(); //$("#floatBoxBg").animate({opacity:"0"},"normal",function(){$(this).hide();}); //$("#floatBox").animate({top:($(document).scrollTop()-(height=="auto"?300:parseInt(height)))+"px"},"normal",function(){$(this).hide();}); }); $("#floatBox .title h4").html(title); contentType=content.substring(0,content.indexOf(":")); content=content.substring(content.indexOf(":")+1,content.length); switch(contentType){ case "url": var content_array=content.split("?"); $("#floatBox .content").ajaxStart(function(){ $(this).html("loading..."); }); $.ajax({ type:content_array[0], url:content_array[1], data:content_array[2], error:function(){ $("#floatBox .content").html("error..."); }, success:function(html){ $("#floatBox .content").html(html); } }); break; case "text": $("#floatBox .content").html(content); break; case "id": $("#floatBox .content").html($("#"+content+"").html()); break; case "iframe": $("#floatBox .content").html(""); } $("#floatBoxBg").show(); $("#floatBoxBg").animate({opacity:"0.5"},0); $("#floatBox").attr("class","floatBox "+cssName); $("#floatBox").css({display:"block",left:(($(document).width())/2-(parseInt(width)/2))+"px",top:($(document).scrollTop()-(height=="auto"?300:parseInt(height)))+"px",width:width,height:height}); $("#floatBox").animate({top:($(document).scrollTop()+80)+"px"},0); } function leeDialog1(title,content,width,height,cssName){ if(dialogFirst==true){ var temp_float=new String; temp_float="
"; temp_float+="
"; temp_float+="

"; temp_float+="
"; temp_float+="
"; $("body").append(temp_float); dialogFirst=false; } $("#floatBox .title span").click(function(){ $("#floatBoxBg").hide(); $("#floatBox").hide(); //$("#floatBoxBg").animate({opacity:"0"},"normal",function(){$(this).hide();}); //$("#floatBox").animate({top:($(document).scrollTop()-(height=="auto"?300:parseInt(height)))+"px"},"normal",function(){$(this).hide();}); }); $("#floatBox .title h4").html(title); contentType=content.substring(0,content.indexOf(":")); content=content.substring(content.indexOf(":")+1,content.length); switch(contentType){ case "url": var content_array=content.split("?"); $("#floatBox .content").ajaxStart(function(){ $(this).html("loading..."); }); $.ajax({ type:content_array[0], url:content_array[1], data:content_array[2], error:function(){ $("#floatBox .content").html("error..."); }, success:function(html){ $("#floatBox .content").html(html); } }); break; case "text": $("#floatBox .content").html(content); break; case "id": $("#floatBox .content").html($("#"+content+"").html()); break; case "iframe": $("#floatBox .content").html(""); } $("#floatBoxBg").show(); $("#floatBoxBg").animate({opacity:"0.5"},0); $("#floatBox").attr("class","floatBox "+cssName); $("#floatBox").css({display:"block",left:(($(document).width())/2-(parseInt(width)/2))+"px",top:($(document).scrollTop()-(height=="auto"?300:parseInt(height)))+"px",width:width,height:height}); $("#floatBox").animate({top:($(document).scrollTop()+80)+"px"},0); }