JQuery Mask Layer Effect Example Analysis _ jquery-js tutorial

Source: Internet
Author: User
This article mainly introduces the effects of the jQuery mask layer, and analyzes in detail the principle and related technical details of jQuery's implementation of the mask layer based on the example form, if you need it, you can refer to the examples in this article to analyze the effects of the jQuery mask layer. We will share this with you for your reference. The details are as follows:

Let's take a look at the sample code:

 
 Example | xHTML1.0
 
  
 
 
  
 Click

Close

In fact, the principle of the mask layer is very simple.

One p is used to cover the following content.

One of the most important css styles is

X-index: integer

The larger the value is in the upper layer, the smaller the value is in the lower layer, which can be a negative number.

The above js Code has some errors. The following has been corrected.

// Display layer function showBox (id) {var bH = document. body. offsetHeight; // $ (window ). height (); var bW = document. body. offsetWidth; // $ (window ). width (); if (bH <$ (window ). height () {bH = $ (window ). height () ;}$ ("# full_box" ).css ({width: bW, height: bH, display: "block"}); var objWH = getObjWh ('Dialog '); var tbT = objWH. split ("|") [0] + "px"; var tbL = objWH. split ("|") [1] + "px"; if (id = 'template') {$ ("# p_template "). show ();} else if (id = 'History ') {$ ("# p_history "). show ();} else {$ ("# tree _" + id ). show () ;}$ (window ). scroll (function () {resetBox (id) ;}); $ (window ). resize (function () {resetBox (id) ;});} // reset the layer function resetBox (id) {var full_box = $ ("# full_box" ).css ("display"); if (full_box = 'block') {var bH = document. body. offsetHeight; // $ (window ). height (); var bW = document. body. offsetWidth; // $ (window ). width (); if (bH <$ (window ). height () {bH = $ (window ). height ();} var objWH = getObjWh ('Dialog '); var tbT = objWH. split ("|") [0] + "px"; var tbL = objWH. split ("|") [1] + "px"; $ (". dialog "detail .css ({top: tbT, left: tbL}); $ (" # full_box "detail .css ({width: bW, height: bH });}} // obtain the layer Parameter function getObjWh (obj) {var st = $ (window ). scrollTop (); var sl =$ (window ). scrollLeft (); var ch = $ (window ). height (); var cw = $ (window ). width (); var ob1_=$ ("#" + obj ). height (); var objW = $ ("#" + obj ). width (); var objT = Number (st) + (Number (ch)-Number (ob1_))/2; var objL = Number (sl) + (Number (cw) -Number (objW)/2; return objT + "|" + objL;} // function closeBox (id) {if (id = 'template ') {$ ("# p_template "). hide ();} else if (id = 'History ') {$ ("# p_history "). hide ();} else {$ ("# tree _" + id ). hide () ;}$ ("# full_box "). hide ();}

Related Article

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.