/** * jquery ligerui 1.2.4 * * http://ligerui.com * * author daomi 2014 [ gd_star@163.com ] * */ (function ($) { //气泡,可以在制定位置显示 $.ligertip = function (p) { return $.ligerui.run.call(null, "ligertip", arguments); }; //在指定dom element右侧显示气泡 //target:将ligerui对象id附加上 $.fn.ligertip = function (options) { this.each(function () { var p = $.extend({}, $.ligerdefaults.elementtip, options || {}); p.target = p.target || this; //如果是自动模式:鼠标经过时显示,移开时关闭 if (p.auto || options == undefined) { if (!p.content) { p.content = this.title; if (p.removetitle) $(this).removeattr("title"); } p.content = p.content || this.title; $(this).bind('mouseover.tip', function () { p.x = $(this).offset().left + $(this).width() + (p.distancex || 0); p.y = $(this).offset().top + (p.distancey || 0); $.ligertip(p); }).bind('mouseout.tip', function () { var tipmanager = $.ligerui.managers[this.ligeruitipid]; if (tipmanager) { tipmanager.remove(); } }); } else { if (p.target.ligeruitipid) return; p.x = $(this).offset().left + $(this).width() + (p.distancex || 0); p.y = $(this).offset().top + (p.distancey || 0); p.x = p.x || 0; p.y = p.y || 0; $.ligertip(p); } }); return $.ligerui.get(this, 'ligeruitipid'); }; //关闭指定在dom element(附加了ligerui对象id,属性名"ligeruitipid")显示的气泡 $.fn.ligerhidetip = function (options) { return this.each(function () { var p = options || {}; if (p.islabel == undefined) { //如果是lable,将查找指定的input,并找到ligerui对象id p.islabel = this.tagname.tolowercase() == "label" && $(this).attr("for") != null; } var target = this; if (p.islabel) { var forele = $("#" + $(this).attr("for")); if (forele.length == 0) return; target = forele[0]; } var tipmanager = $.ligerui.managers[target.ligeruitipid]; if (tipmanager) { tipmanager.remove(); } }).unbind('mouseover.tip').unbind('mouseout.tip'); }; $.fn.ligergettipmanager = function () { return $.ligerui.get(this); }; $.ligerdefaults = $.ligerdefaults || {}; //隐藏气泡 $.ligerdefaults.hidetip = {}; //气泡 $.ligerdefaults.tip = { content: null, callback: null, width: 150, height: null, x: 0, y: 0, appendidto: null, //保存id到那一个对象(jquery)(待移除) target: null, auto: null, //是否自动模式,如果是,那么:鼠标经过时显示,移开时关闭,并且当content为空时自动读取attr[title] removetitle: true //自动模式时,默认是否移除掉title }; //在指定dom element右侧显示气泡,通过$.fn.ligertip调用 $.ligerdefaults.elementtip = { distancex: 1, distancey: -3, auto: null, removetitle: true }; $.ligermethos.tip = {}; $.ligerui.controls.tip = function (options) { $.ligerui.controls.tip.base.constructor.call(this, null, options); }; $.ligerui.controls.tip.ligerextend($.ligerui.core.uicomponent, { __gettype: function () { return 'tip'; }, __idprev: function () { return 'tip'; }, _extendmethods: function () { return $.ligermethos.tip; }, _render: function () { var g = this, p = this.options; var tip = $('