diff --git a/src/layer.js b/src/layer.js index 6bf3cff..3f9aa52 100644 --- a/src/layer.js +++ b/src/layer.js @@ -185,7 +185,8 @@ Class.pt.config = { Class.pt.vessel = function(conType, callback){ var that = this, times = that.index, config = that.config; var zIndex = config.zIndex + times, titype = typeof config.title === 'object'; - var ismax = config.maxmin && (config.type === 1 || config.type === 2); + var ismax = (config.maxmin || config.max) && (config.type === 1 || config.type === 2); + var ismin = (config.maxmin || config.min) && (config.type === 1 || config.type === 2); var titleHTML = (config.title ? '
' + (titype ? config.title[0] : config.title) + '
' : ''); @@ -203,7 +204,9 @@ Class.pt.vessel = function(conType, callback){ + (config.type == 1 && conType ? '' : (config.content||'')) +'' + ''+ function(){ - var closebtn = ismax ? '' : ''; + var closebtn = ''; + closebtn += ismin ? '' : ''; + closebtn += ismax ? '' : ''; config.closeBtn && (closebtn += ''); return closebtn; }() + '' @@ -327,8 +330,8 @@ Class.pt.auto = function(index){ }; //计算坐标 -Class.pt.offset = function(){ - var that = this, config = that.config, layero = that.layero; +Class.pt.offset = function (times) { + var that = this, times = times || that.index, config = that.config, layero = $('#' + doms[0] + times); var area = [layero.outerWidth(), layero.outerHeight()]; var type = typeof config.offset === 'object'; that.offsetTop = (win.height() - area[1])/2; @@ -601,6 +604,9 @@ Class.pt.openLayer = function(){ layero.on('mousedown', setZindex); return layer.zIndex; }; + layer.autoOffset = function (index) { + return that.offset(index); + }; }; ready.record = function(layero){ @@ -781,4 +787,4 @@ ready.run = function(){ layer.use('skin/layer.css'); }(); -}(window); \ No newline at end of file +}(window);