JS mask layer and the pull-up box on the mobile side

Source: Internet
Author: User

Today, a previously written mobile project, mainly about masking layer application, and incidentally mention some of the mobile development of things. First click on the pop-up mask layer This everyone is very familiar with, here or to provide you with a code, with the general not much difference, mainly talk about the method:

$ (function () {

var jiage=$ (". Jiage"), xingji=$ (". Xingji"), fj=$ (". FJ Li"), qd=$ (". QD");
Jiage.click (function () {
Tanchu ();
Xingji.slidedown (260);

});
function Tanchu () {
var w=document.createelement ("div");
W.setattribute ("id", "mybody"); Create a transparent background layer (MYBODY)
With (W.style) {
Width= ' 100% ';
height= ' 100% '
Position = ' absolute ';
ZIndex = ' 10 ';
left = ' 0 ';
top = ' 0 ';
Background = ' #000000 ';
Filter = ' Alpha ' (opacity=50);
opacity = ' 0.3 ';
}
Document.body.appendChild (w);
}

Fj.click (function () {
FJ.CSS ("Background", "#fff"). CSS ("Box-shadow", "0"). CSS ("Color", "#000");
$ (this). CSS ("Background", "#F4F4F4"). CSS ("Box-shadow", "0px 1px 0px #999 inset"). CSS ("Color", "#31A1A4");

});

Clear Mask Layer after click
Qd.click (function () {
Xingji.slideup (300);
var m=$ ("#mybody");
M.remove ();
});
});

Masking layer code Nothing to say, JQ Basic DOM operation, of course, it is necessary to pick up, but also easy to read. It is also worth mentioning that the mask layer of the pop-up window should be careful to destroy, and here because there is a definite option on the page, so by clicking OK after the clear mask layer. Of course, here's a way to do a pull-up box on the mobile side. I use the pull-up box first with the absolute positioning of the fixed, and then click on the time to pull down, because its own JQ slideup to take the div from 0 to big, so this approach can achieve the effect we want. Attached sheet:

Here to mention that the project was previously done in small companies outsourcing projects, initially only achieved the effect, and the user experience is actually very poor, the browser to take the same effect as the client obviously has a large defect, slow reaction. Of course, in a way, debugging can also improve a part of the effect.

JS mask layer and the pull-up box on the mobile side

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.