日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

html弹出窗口加载别的页面地址,仿layer.open打开新窗口URL,自适应URL页面高度

發(fā)布時間:2024/10/12 编程问答 43 豆豆
生活随笔 收集整理的這篇文章主要介紹了 html弹出窗口加载别的页面地址,仿layer.open打开新窗口URL,自适应URL页面高度 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

layer.open打開新窗口URL,不能在彈出窗口的同時根據(jù)所打開URL地址頁面的大小,彈出的同時自適應(yīng)窗口大小,所以根據(jù)需要自己寫了一個,請參考指正。

首先加載jquery

下面是js代碼:

// 2016-08-10 自適應(yīng)彈窗插件

var?wlayer?=?{

node:?null,

url:?null,

popup:?function()?{

this.url?=?arguments[0];

this.count?=?arguments[1];

this.addShade();

this.addIframe(this.url);

this.dishow();

},

close:?function()?{

this.node?=?$(window.parent.document);

this.node.find("iframe#popup").remove();

this.node.find("div#wshade").remove();

},

//?添加?iframe?框

addIframe:?function()?{

var?html?=?'';

$('body').append(html);

this.loadStyle();

},

loadStyle:?function()?{

$('iframe#popup').load(function()?{

$(this).css({?"position":?"fixed",?"z-index":?"999",?"width":?"683px"?});

var?frameCon?=?$(this).contents().find("body");

var?pwidth?=?frameCon.width();

var?pheight?=?frameCon.height();

$(this).height(pheight?+?2);

var?top?=?($(window).innerHeight()?-?$(this).outerHeight())?/?2;

var?left?=?($(window).innerWidth()?-?$(this).outerWidth())?/?2;

$(this).css({?"top":?top,?"left":?left,?"border":?"1px?solid?#ccc"?});

$('div#wshade').show();

});

},

dishow:?function()?{

$('iframe#popup').show();

},

addShade:?function()?{

var?shadeHtml?=?'';

$('body').append(shadeHtml);

$('div#wshade').css({

"position":"fixed","top":"0","left":"0",

"z-index":"998","width":"100%","height":"100%"

});

$('div#wshade').css({

"background-color":"#333","filter":"alpha(opacity=30)",

"-moz-opacity":?"0.3","opacity":"0.3"

});

}

};

使用用例:

1.彈窗顯示指定URL地址

wlayer.popup(url);

2.關(guān)閉彈窗

wlayer.close();

如有改進已經(jīng),請聯(lián)系站長。

總結(jié)

以上是生活随笔為你收集整理的html弹出窗口加载别的页面地址,仿layer.open打开新窗口URL,自适应URL页面高度的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。