国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

jquery自定義插件開發(fā)之window的實現(xiàn)過程

2019-11-20 10:08:39
字體:
來源:轉載
供稿:網(wǎng)友

本例子實現(xiàn)彈窗的效果:如果親感覺效果還不錯,請繼續(xù)往下閱讀。

1、jquery.show.js

/** 開發(fā)者:lzugis* 開發(fā)時間:2014年6月10日* 實現(xiàn)功能:點擊在鼠標位置顯示div* 版本序號:1.0 */(function($){ $.fn.showDIV = function(options){var defaults = {};var options = $.extend(defaults, options);var showdiv=$(this);var close, title, content;close=$(" "); title=$(" "); content=$(" "); showdiv.html(""); showdiv.append(close); showdiv.append(title); showdiv.append(content); close.html("X"); title.html(options.title); content.html(options.content); showdiv.css("display","block"); showdiv.css("position","absolute"); showdiv.css("left",($(window).width()-options.width)/2+"px"); showdiv.css("top",($(window).height()-options.height)/2+"px"); showdiv.css("width",options.width); showdiv.css("height",options.height); close.bind("click",function(){ showdiv.css("display","none"); }); }; })(jQuery);

2、jquery.showdiv.css

body div{font-size:12px;text-align:center;}#container{background-color:#CCC;border:1px solid #000;width:1024px;height:600px;}#showdiv{background-color:#FF0;width:100px;height:100px;display:none;z-index:99;}.title{padding:10px;background:#F39;font-weight:bold;text-align:center;color:#FFF;}.close{margin:5px;position:absolute;right:0px;top::0px;padding:5px;color:#000;background:#FFF;}.close:hover{cursor:pointer;background:#CCC;}.content{text-align:left;padding:10px;} 

3、demo.html

<script type="text/javascript" src="jquery/jquery.min.js"></script><script type="text/javascript" src="jquery/jquery.showdiv.js"></script><script type="text/javascript">$(document).ready(function (){ $('#show').bind("click", function(evt){var showdiv = $('#showdiv').showDIV({width:400,height:200,title:"我不是黃蓉",content:"我不是黃蓉<br>我不會武功<br>我只要靖哥哥<br>完美的愛情"}); });});</script><input id="show" name="showDiv" value="顯示" type="button"> 

以上所述是小編給大家介紹的jquery自定義插件開發(fā)之window的實現(xiàn)過程,希望對大家有所幫助!同時也非常感謝大家對武林網(wǎng)網(wǎng)站的支持!

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 襄樊市| 兰考县| 兰州市| 黄浦区| 福州市| 玛曲县| 山西省| 临朐县| 肥乡县| 甘南县| 宁波市| 嘉兴市| 宁蒗| 天津市| 东乌| 玉龙| 涿鹿县| 碌曲县| 兴山县| 库车县| 昌平区| 兴仁县| 通州市| 平山县| 韶山市| 汽车| 周口市| 双柏县| 顺平县| 晋州市| 襄垣县| 龙游县| 霍林郭勒市| 九寨沟县| 濮阳县| 平舆县| 锦州市| 呼玛县| 堆龙德庆县| 花垣县| 盱眙县|