jquery Mask Layer display img

Source: Internet
Author: User

If you click an image in the IFrame to display the mask layer for the entire page, refer to the following:

http://blog.csdn.net/shiaijuan1/article/details/70160714

The concrete idea is that the top layer adds DOM objects, which are used to display information, are hidden by default, are called in the IFrame when needed, and the width height is set to 100%.

The implementation is as follows:

//Mask layer. Showmask{position:fixed;Z-index: About;width:100%;Height:100%;Background-color:Silver;Top:0px; Left:0px;Opacity:0.5; }. Showmasklayer{position:Absolute;Z-index:168;Top:0px; Left:0px;Min-width:100%;Min-height:100%;Display:Flex;justify-content:Center;Align-items:Center; }//Close button. Showmaskclose{Background-color:Red;Color: White;Border:2px solid Gray;position:fixed;Z-index:288;Top:0px; Right:0px;cursor:Pointer;Height:30px;width:30px;font-size:Large;Font-weight:Bold;text-align:Center;Display:Flex;justify-content:Center;Align-items:Center; }

The IFRAME is called as follows:

$(function () {        $("#image"). On ("click",function () {            //Determine if the mask layer Dom has been added            if($ (". Showmaskclose", window.top.document). length = = 0) {                //additional matte layer Dom$ ("Body", window.top.document). Append ("<div class= ' showmaskclose ' >x</div>"). Append ("<div class=" Showmask ' ></div> '). Append ("<div class= ' Showmasklayer ' ></div>")                //attaching a post-bind event$ (". Showmaskclose", Window.top.document). On ("click",function() {htshide ();}) $(". Showmask", Window.top.document). On ("DblClick",function() {htshide ();}) $(". Showmasklayer", Window.top.document). On ("DblClick",function() {htshide ();}) //Add a picture$ (". Showmasklayer", window.top.document). Append (" This. src + "'/>")            }            Else {                //Mask Layer DOM display$ (". Showmaskclose", Window.top.document). Show (); $(". Showmask", Window.top.document). Show (); $(". Showmasklayer", Window.top.document). Show (); //Toggle Picture$ (". Showmasklayer > img", window.top.document). attr (' src ', This. SRC);    }        });    }); functionhtshide () {//Mask Layer Hide$ (". Showmask", window.top.document). Hide (); $(". Showmaskclose", window.top.document). Hide (); $(". Showmasklayer", window.top.document). Hide (); }

jquery Mask Layer display img

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.