一个弹窗效果
来源:互联网 发布:qq同步mac电脑版 编辑:程序博客网 时间:2024/04/28 20:40
今天有朋友叫帮忙弄个弹窗评论的效果,我想既然要弄就弄得好看点吧。在网上找了下资料,发现lee dialog 还不错,就拿来用了。先上效果图
没人做页面,只能自己硬着头皮,弄起生疏的CSS了。
下面是lee dialog的代码
var dialogFirst=true;
function dialog(title,content,width,height,cssName){
if(dialogFirst==true){
var temp_float=new String;
temp_float="<div id=/"floatBoxBg/" style=/"height:"+$(document).height()+"px;filter:alpha(opacity=0);opacity:0;/"></div>";
temp_float+="<div id=/"floatBox/" class=/"floatBox/">";
temp_float+="<div class=/"title/"><h4></h4><span>关闭</span></div>";
temp_float+="<div class=/"content/"></div>";
temp_float+="</div>";
$("body").append(temp_float);
dialogFirst=false;
}
$("#floatBox .title span").click(function(){
$("#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("<iframe src=/""+content+"/" width=/"100%/" height=/""+(parseInt(height)-30)+"px"+"/" scrolling=/"auto/" frameborder=/"0/" marginheight=/"0/" marginwidth=/"0/"></iframe>");
}
$("#floatBoxBg").show();
$("#floatBoxBg").animate({opacity:"0.5"},"normal");
$("#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()+50)+"px"},"normal");
}
调用:dialog("我的评价","url:get?comment.php","600px","300px","text")
- 一个弹窗效果
- 一个基于jQuery写的弹窗效果(附源码)
- 自己整理一个div的jquery弹窗效果
- 一个简单带动画效果tableview弹窗菜单
- 一个效果
- 一个不错的效果
- 一个层下拉效果
- 一个简单css效果
- 一个搜索条效果
- 一个选项卡效果
- 一个按钮的效果
- 一个按钮的效果
- 一个jQuery效果
- 一个动画效果
- 实现一个进度条效果
- 弹窗效果
- 弹窗效果:TipsWindown
- 帖一个简单css效果
- CISCO一路同行--记我的安全CCIE历程
- Linux教程- Vi的进入与退出
- 使用存储过程导出数据脚本
- c#数组简单排序方法
- c#深拷贝与浅拷贝
- 一个弹窗效果
- 关于类似RichEdit控件的设计思想
- Gallery3D
- javascript:void(0)
- 大家好,终于在CSDN安家了
- Vim编辑器入门
- C 语言的谜题!你会几个?
- vc中ifstream ofstream不能读取带有中文路径
- H3C S3600 交换机NTP对等体模式的配置