发布于 2016-08-30 09:37:08 | 158 次阅读 | 评论: 0 | 来源: 网友投递

这里有新鲜出炉的精品教程,程序狗速度看过来!

EasyUI jQuery UI插件

jQuery EasyUI是一组基于jQuery的UI插件集合,而jQuery EasyUI的目标就是帮助web开发者更轻松的打造出功能丰富并且美观的UI界面。开发者不需要编写复杂的javascript,也不需要对css样式有深入的了解,开发者需要了解的只有一些简单的html标签。


在次封装easyui-Dialog插件实现代码,需要的朋友可以参考下。
 
$.fn.hDialog = function (options) { 
var defaults = { 
width: 300, 
height: 200, 
title: '此处标题', 
html: '', 
iconCls: '', 
submit: function () { alert('可执行代码.'); } 
} 
var id = $(this).attr('id'); 
options = $.extend(defaults, options); 
var self = this; 

$(self).dialog({ 
title: options.title, 
height: options.height, 
width: options.width, 
iconCls: options.iconCls, 
buttons: [{ 
text: '确定', 
iconCls: 'icon-ok', 
handler: options.submit 
}, { 
text: '取消', 
iconCls: 'icon-cancel', 
handler: function () { 
$('#' + id).dialog('close'); 
} 
}] 
}); 

function createContent() { 
$('.dialog-content',$(self)).empty().append('<div id="' + id + '_content" style="padding:5px;"></div>'); 
$('#' + id + "_content").html(options.html); 
} 
createContent(); 
} 

调用:
 
$(function(){ 
  var d =$('<div id="d"></div>'); 
  $('#d').hDialog({submit:function(){$(d).dialog('close');}}); 
}) 


最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务