Home >Web Front-end >JS Tutorial >Specific implementation of a masking effect using js iframe to form a page_javascript skills

Specific implementation of a masking effect using js iframe to form a page_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:06:04943browse

Before using this code, please download the jquery library

Copy the code The code is as follows:

var maskStackCount = 0;

function mask(method){

//This is the window you want to mask. What I want to mask here is an iframe window. You can also use var winObj=$(window)

var winObj=window.top.$("body").find("iframe[name='dialognormaliframe']");
if(typeof method == " undefined"){
method="open";
}
if (method == "open") {
if (maskStackCount <= 0) {
var mask = $( "").appendTo("body");
mask.css({
width: winObj.width() "px",
height: winObj.height() "px",
filter: "alpha(opacity=60)"
}).show() ;
winObj.on("resize.mask", function(){
mask.css({
width: winObj.width() "px",
height: winObj.height() "px"
});
});
}
maskStackCount;
}
else if(method == "close"){
maskStackCount--;
$("#window-mask").remove();
winObj.off("resize.mask");
}
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn