阅读背景:

jquery自定义插件——window的实现

来源:互联网 

本例子实现弹窗的效果:


1、jquery.show.js

/*
 * 开发者:lzugis
 * 开发时间:2014年6月10日
 * 实现功能:点击在鼠标位置显示div
 * 版本序号:1.0 
 */
(function($){ 
 	$.fn.showDIV = function(options){
		var defaults = {};
		var options = $.extend(defaults, options);
		var showdiv=$(this);
		var close, title, content;
		close=$("<div class='close'></div>");
		title=$("<div class='title'></div>");
		content=$("<div class='content'></div>");
		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);/*
 * 开



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: