惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
P
Privacy & Cybersecurity Law Blog
G
GRAHAM CLULEY
T
The Exploit Database - CXSecurity.com
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Project Zero
Project Zero
S
Security @ Cisco Blogs
TaoSecurity Blog
TaoSecurity Blog
A
Arctic Wolf
Webroot Blog
Webroot Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
Security Latest
Security Latest
H
Heimdal Security Blog
N
News and Events Feed by Topic
N
News | PayPal Newsroom
T
Tor Project blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
GbyAI
GbyAI
The Last Watchdog
The Last Watchdog
Y
Y Combinator Blog
宝玉的分享
宝玉的分享
Scott Helme
Scott Helme
A
About on SuperTechFans
M
MIT News - Artificial intelligence
V
V2EX
V
Visual Studio Blog
Recorded Future
Recorded Future
博客园 - 叶小钗
F
Fortinet All Blogs
L
Lohrmann on Cybersecurity
The GitHub Blog
The GitHub Blog
博客园 - Franky
P
Proofpoint News Feed
MyScale Blog
MyScale Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
S
Secure Thoughts
D
DataBreaches.Net
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 三生石上(FineUI控件)
I
InfoQ
SecWiki News
SecWiki News
Blog — PlanetScale
Blog — PlanetScale
Engineering at Meta
Engineering at Meta
J
Java Code Geeks
B
Blog RSS Feed
AWS News Blog
AWS News Blog
Know Your Adversary
Know Your Adversary
V
Vulnerabilities – Threatpost
H
Help Net Security

博客园 - 克隆

SVN快速入门(TSVN) C# HttpWebRequest提交数据方式浅析 简单的3个SQL视图搞定所有SqlServer数据库字典 简单统计SQLSERVER用户数据表大小(包括记录总数和空间占用情况) 敏捷开发Scrum 学习笔记,适于移动开发 团队的职责和任务之间的关系 精心收集的jQuery常用的插件1000 24款超实用的Web 2.0风格翻页代码 【转】使用 Entity Framework + ListView + DataPager 实现数据分页 (转)ASP.NET页面打印技术的总结 [转]数据库设计 Step by Step (5) SQLServer2008/2005 生成数据字典SQL语句 SQL HierarchyID 数据类型 OSWorkflow表结构分析 javascript动态创建VML [转]由于项目原因看了一下vml,写了一个Web工作流的设计器雏形! VML流程图 启用IIS的Gzip压缩 IIS压缩
[转]jquery插件弹出div
克隆 · 2011-04-15 · via 博客园 - 克隆

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238

239

240

241

242

243

244

245

246

247

248

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

264

265

266

267

268

269

270

271

272

273

274

275

276

277

278

279

280

281

282

283

284

(function($) {

 var openedPopups = [];

 var popupLayerScreenLocker = false;

 var focusableElement = [];

 var setupJqueryMPopups = {

 screenLockerBackground: "#000",

 screenLockerOpacity: "0.5"

 };

 $.setupJMPopups = function(settings) {

 setupJqueryMPopups = jQuery.extend(setupJqueryMPopups, settings);

 return this;

 }

 $.openPopupLayer = function(settings) {

 if (typeof(settings.name) != "undefined" && !checkIfItExists(settings.name)) {

 settings = jQuery.extend({

 width: "auto",

 height: "auto",

 parameters: {},

 target: "",

 success: function() {},

 error: function() {},

 beforeClose: function() {},

 afterClose: function() {},

 reloadSuccess: null,

 cache: false

 }, settings);

 loadPopupLayerContent(settings, true);

 return this;

 }

 }

 $.closePopupLayer = function(name) {

 if (name) {

 for (var i = 0; i < openedPopups.length; i++) {

 if (openedPopups[i].name == name) {

 var thisPopup = openedPopups[i];

 openedPopups.splice(i,1)

 thisPopup.beforeClose();

 $("#popupLayer_" + name).fadeOut(function(){

 $("#popupLayer_" + name).remove();

 focusableElement.pop();

 if (focusableElement.length > 0) {

 $(focusableElement[focusableElement.length-1]).focus();

 }

 thisPopup.afterClose();

 hideScreenLocker(name);

 });

 break;

 }

 }

 } else {

 if (openedPopups.length > 0) {

 $.closePopupLayer(openedPopups[openedPopups.length-1].name);

 }

 }

 return this;

 }

 $.reloadPopupLayer = function(name, callback) {

 if (name) {

 for (var i = 0; i < openedPopups.length; i++) {

 if (openedPopups[i].name == name) {

 if (callback) {

 openedPopups[i].reloadSuccess = callback;

 }

 loadPopupLayerContent(openedPopups[i], false);

 break;

 }

 }

 } else {

 if (openedPopups.length > 0) {

 $.reloadPopupLayer(openedPopups[openedPopups.length-1].name);

 }

 }

 return this;

 }

 function setScreenLockerSize() {

 if (popupLayerScreenLocker) {

 $('#popupLayerScreenLocker').height($(document).height() + "px");

 $('#popupLayerScreenLocker').width($(document.body).outerWidth(true) + "px");

 }

 }

 function checkIfItExists(name) {

 if (name) {

 for (var i = 0; i < openedPopups.length; i++) {

 if (openedPopups[i].name == name) {

 return true;

 }

 }

 }

 return false;

 }

 function showScreenLocker() {

 if ($("#popupLayerScreenLocker").length) {

 if (openedPopups.length == 1) {

 popupLayerScreenLocker = true;

 setScreenLockerSize();

 $('#popupLayerScreenLocker').fadeIn();

 }

 if ($.browser.msie && $.browser.version < 7) {

 $("select:not(.hidden-by-jmp)").addClass("hidden-by-jmp hidden-by-" + openedPopups[openedPopups.length-1].name).css("visibility","hidden");

 }

 $('#popupLayerScreenLocker').css("z-index",parseInt(openedPopups.length == 1 ? 999 : $("#popupLayer_" + openedPopups[openedPopups.length - 2].name).css("z-index")) + 1);

 } else {

 $("body").append("<div id='popupLayerScreenLocker'><!-- --></div>");

 $("#popupLayerScreenLocker").css({

 position: "absolute",

 background: setupJqueryMPopups.screenLockerBackground,

 left: "0",

 top: "0",

 opacity: setupJqueryMPopups.screenLockerOpacity,

 display: "none"

 });

 showScreenLocker();

 $("#popupLayerScreenLocker").click(function() {

 $.closePopupLayer();

 });

 }

 }

 function hideScreenLocker(popupName) {

 if (openedPopups.length == 0) {

 screenlocker = false;

 $('#popupLayerScreenLocker').fadeOut();

 } else {

 $('#popupLayerScreenLocker').css("z-index",parseInt($("#popupLayer_" + openedPopups[openedPopups.length - 1].name).css("z-index")) - 1);

 }

 if ($.browser.msie && $.browser.version < 7) {

 $("select.hidden-by-" + popupName).removeClass("hidden-by-jmp hidden-by-" + popupName).css("visibility","visible");

 }

 }

 function setPopupLayersPosition(popupElement, animate) {

 if (popupElement) {

 if (popupElement.width() < $(window).width()) {

 var leftPosition = (document.documentElement.offsetWidth - popupElement.width()) / 2;

 } else {

 var leftPosition = document.documentElement.scrollLeft + 5;

 }

 if (popupElement.height() < $(window).height()) {

 var topPosition = document.documentElement.scrollTop + ($(window).height() - popupElement.height()) / 2;

 } else {

 var topPosition = document.documentElement.scrollTop + 5;

 }

 var positions = {

 left: leftPosition + "px",

 top: topPosition + "px"

 };

 if (!animate) {

 popupElement.css(positions);

 } else {

 popupElement.animate(positions, "slow");

 }

 setScreenLockerSize();

 } else {

 for (var i = 0; i < openedPopups.length; i++) {

 setPopupLayersPosition($("#popupLayer_" + openedPopups[i].name), true);

 }

 }

 }

 function showPopupLayerContent(popupObject, newElement, data) {

 var idElement = "popupLayer_" + popupObject.name;

 if (newElement) {

 showScreenLocker();

 $("body").append("<div id='" + idElement + "'><!-- --></div>");

 var zIndex = parseInt(openedPopups.length == 1 ? 1000 : $("#popupLayer_" + openedPopups[openedPopups.length - 2].name).css("z-index")) + 2;

 else {

 var zIndex = $("#" + idElement).css("z-index");

 }

 var popupElement = $("#" + idElement);

 popupElement.css({

 visibility: "hidden",

 width: popupObject.width == "auto" ? "" : popupObject.width + "px",

 height: popupObject.height == "auto" ? "" : popupObject.height + "px",

 position: "absolute",

 "z-index": zIndex

 });

 var linkAtTop = "<a href='#' class='jmp-link-at-top' style='position:absolute; left:-9999px; top:-1px;'>&nbsp;</a><input class='jmp-link-at-top' style='position:absolute; left:-9999px; top:-1px;' />";

 var linkAtBottom = "<a href='#' class='jmp-link-at-bottom' style='position:absolute; left:-9999px; bottom:-1px;'>&nbsp;</a><input class='jmp-link-at-bottom' style='position:absolute; left:-9999px; top:-1px;' />";

 popupElement.html(linkAtTop + data + linkAtBottom);

 setPopupLayersPosition(popupElement);

 popupElement.css("display","none");

 popupElement.css("visibility","visible");

 if (newElement) {

 popupElement.fadeIn();

 } else {

 popupElement.show();

 }

 $("#" + idElement + " .jmp-link-at-top, " +

 "#" + idElement + " .jmp-link-at-bottom").focus(function(){

 $(focusableElement[focusableElement.length-1]).focus();

 });

 var jFocusableElements = $("#" + idElement + " a:visible:not(.jmp-link-at-top, .jmp-link-at-bottom), " +

 "#" + idElement + " *:input:visible:not(.jmp-link-at-top, .jmp-link-at-bottom)");

 if (jFocusableElements.length == 0) {

 var linkInsidePopup = "<a href='#' class='jmp-link-inside-popup' style='position:absolute; left:-9999px;'>&nbsp;</a>";

 popupElement.find(".jmp-link-at-top").after(linkInsidePopup);

 focusableElement.push($(popupElement).find(".jmp-link-inside-popup")[0]);

 } else {

 jFocusableElements.each(function(){

 if (!$(this).hasClass("jmp-link-at-top") && !$(this).hasClass("jmp-link-at-bottom")) {

 focusableElement.push(this);

 return false;

 }

 });

 }

 $(focusableElement[focusableElement.length-1]).focus();

 popupObject.success();

 if (popupObject.reloadSuccess) {

 popupObject.reloadSuccess();

 popupObject.reloadSuccess = null;

 }

 }

 function loadPopupLayerContent(popupObject, newElement) {

 if (newElement) {

 openedPopups.push(popupObject);

 }

 if (popupObject.target != "") {

 showPopupLayerContent(popupObject, newElement, $("#" + popupObject.target).html());

 } else {

 $.ajax({

 url: popupObject.url,

 data: popupObject.parameters,

 cache: popupObject.cache,

 dataType: "html",

 method: "GET",

 success: function(data) {

 showPopupLayerContent(popupObject, newElement, data);

 },

 error: popupObject.error

 });

 }

 }

 $(window).resize(function(){

 setScreenLockerSize();

 setPopupLayersPosition();

 });

 $(document).keydown(function(e){

 if (e.keyCode == 27) {

 $.closePopupLayer();

 }

 });

})(jQuery);