源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

一个jquery的弹出层的插件第1/2页

  • 时间:2022-07-10 23:58 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:一个jquery的弹出层的插件第1/2页
[url=]})(); __index = $.layermaxindex(); var __left = (__bw - _width) > 0 ? (__bw - _width)/2 : 0; var __top = 100; var __bgDiv = '<div id="'+___id___+'_background" style="background:#000000; filter:alpha(opacity='+(opacity*100)+'); opacity: '+opacity+'; width:'+__bw+'px; height:'+__bh+'px; z-index:'+(__index++)+'; position:absolute; left:0px; top:0px;"></div>'; if($.layerSettings.isbg) { $("body",win.document).append(__bgDiv); } $("body",win.document).append('<div id="'+___id___+'" style="z-index:'+__index+';position:absolute; left:'+__left+'px; top:'+__top+'px;"></div>'); var _templete = $.layerSettings.templete; var __templete = _templete.replaceAll("@width@",_width).replaceAll("@height@",_height).replaceAll("@titleid@",_titleid).replaceAll("@contentid@",_contentid).replaceAll("@title@",jQuery.layerSettings.title).replaceAll("@moveid@",_moveid); $("#"+___id___,win.document).append(__templete); $("#"+_contentid,win.document).append($.layerSettings.content); var self = window.self; var ___win = $.layerSettings.target.document; var idd = ___id___; $(".layerclose",win.document).bind("click",function() { self.$.layerclose(idd,___win); }); $("#"+___id___,win.document).bind("click",function() { var id = this.id; self.$.layerSetup(___settings___[id]); self.$(this).css("z-index",$.layermaxindex()); }); $(win.document,win).bind("click",function(e) { var pos = self.$.getMousePosition(e); }); $(win.document,win).mousemove(function(e){ if(isMouseDown && dragStatus[currentElement.id] != 'false'){ self.$.updatePosition(e); if(dragCallbacks[currentElement.id] != undefined){ dragCallbacks[currentElement.id](e, currentElement); } return false; } }); $(win.document,win).mouseup(function(e){ if(isMouseDown && dragStatus[currentElement.id] != 'false'){ isMouseDown = false; if(dropCallbacks[currentElement.id] != undefined){ dropCallbacks[currentElement.id](e, currentElement); } return false; } }); (function(){ bubblings[___id___] = true; dragStatus[___id___] = "on"; //setHandler bubblings[this.id] = true; dragStatus[_moveid] = "handler"; $("#"+_moveid,win.document).css("cursor", "move"); $("#"+_moveid,win.document).mousedown(function(e){ var id = this.id.replace("_move",""); ___id___ = id; self.$("#"+id,win.document).css("z-index",$.layermaxindex()); self.$.layerSetup(___settings___[id]); if((dragStatus[___id___] == "off") || (dragStatus[___id___] == "handler" && !holdingHandler)) return bubblings["#"+___id___]; isMouseDown = true; currentElement = self.$("#"+___id___); var pos = self.$.getMousePosition(e); lastMouseX = pos.x; lastMouseY = pos.y; lastElemTop = win.document.getElementById(___id___).offsetTop; lastElemLeft = win.document.getElementById(___id___).offsetLeft; self.$.updatePosition(e); holdingHandler = true; }); $("#"+_moveid,win.document).mouseup(function(e){ holdingHandler = false; }); //end setHandler })(); }, layerclose:function(__id,__win) { $("#"+__id+"_background",__win).remove(); $("#"+__id,__win).remove(); }, layermaxindex:function() { var ___index = 0; $.each($("*",___win___.document),function(i,n){ var __tem = $(n).css("z-index"); if(__tem>0) { if(__tem > ___index) { ___index = __tem + 1; } } }); return ___index; } }); })(jQuery);
使用方法:
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部