用jquery中插件dialog实现弹框效果实例代码
用jquery中插件dialog实现弹框效果实例代码
发布时间:2016-12-30 来源:查字典编辑
摘要:复制代码代码如下:弹框遮罩效果#dialog_link{padding:.4em1em.4em20px;text-decoration:no...

复制代码 代码如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>弹框遮罩效果</title>

<style type="text/css">

#dialog_link {padding: .4em 1em .4em 20px;text-decoration: none;position: relative;}

#dialog_link span.ui-icon {margin: 0 5px 0 0;position: absolute;left: .2em;top: 50%;margin-top: -8px;}

</style>

<script type="text/javascript" language="javascript" src="jquery-1.7.1.min.js">

</script>

<script type="text/javascript" language="javascript" src="jquery-ui-1.8.18.custom.min.js">

</script>

<link rel="stylesheet" href="ui-lightness/jquery-ui-1.8.18.custom.css"/>

<script type="text/javascript" language="javascript">

$(function(){

$("#dialog").dialog({

autoOpen:false,

buttons:[{

text:"ok",

click:function(){

$("#dialog").dialog("close");

}

},

{

text:"cancal",

click:function(){

$("#dialog").dialog("close");

}

}

],

position:"top",//弹出位置

width:600, //窗口宽度

height:200,

drag:function(){

alert("你干拽我试试");

}

});

$("#dialog_link").click(function(){

$("#dialog").dialog("open");

});

})

</script>

</head>

<body>

<a href="#" id="dialog_link"><span></span>Open Dialog</a>

<>

<div id="dialog" title="Hi">

hello

</div>

</body>

</html>

复制代码 代码如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>弹框遮罩效果</title>

<style type="text/css">

#dialog_link {padding: .4em 1em .4em 20px;text-decoration: none;position: relative;}

#dialog_link span.ui-icon {margin: 0 5px 0 0;position: absolute;left: .2em;top: 50%;margin-top: -8px;}

</style>

<script type="text/javascript" language="javascript" src="jquery-1.7.1.min.js">

</script>

<script type="text/javascript" language="javascript" src="jquery-ui-1.8.18.custom.min.js">

</script>

<link rel="stylesheet" href="ui-lightness/jquery-ui-1.8.18.custom.css"/>

<script type="text/javascript" language="javascript">

$(function(){

$("#dialog").dialog({

autoOpen:false,

buttons:[{

text:"ok",

click:function(){

$("#dialog").dialog("close");

}

},

{

text:"cancal",

click:function(){

$("#dialog").dialog("close");

}

}

],

position:"top",//弹出位置

width:600, //窗口宽度

height:200,

drag:function(){

alert("你干拽我试试");

}

});

$("#dialog_link").click(function(){

$("#dialog").dialog("open");

});

})

</script>

</head>

<body>

<a href="#" id="dialog_link"><span></span>Open Dialog</a>

<>

<div id="dialog" title="Hi">

hello

</div>

</body>

</html>

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新Javascript教程学习
热门Javascript教程学习
编程开发子分类