Summary of the rolling penetration of the mobile pop-up layer

Source: Internet
Author: User

When moving a pop-up layer (called layer), there is a lot of text in the layer that needs scrolling, but the background layer (body) scrolls with the layer scrolling and the user experience is poor. Refer to some information on the Internet, summarize the solution as follows:

. scrollfix{
height:100%;
Overflow:hidden;
position:relative;
}
. Scrollfix body{
height:100%;
Overflow:hidden;
}

Before the pop-up layer:

Prevents the body layer from scrolling down after the content display is not complete problem
$ (' html,body '). Animate ({scrolltop:0}, 100);

$ (' HTML '). addclass (' Scrollfix ');

After the popup layer is closed (typically the layer's shutdown callback):

$ (' HTML '). Removeclass (' Scrollfix ');

There is also a way to disable the background layer Touchmove event

function Showlayer () {
Bgdom.ontouchmove=function (e) {
E.preventdefault && E.preventdefault ();
E.returnvalue=false;
E.stoppropagation && e.stoppropagation ();
return false;
}
}
Or
function Fscrollfix (e) {
E.preventdefault ();
E.stoppropagation ();
}
Bgdom.addeventlistener (' Touchmove ', fscrollfix,false);


function Closelayer ()
{
Bgdom.ontouchmove=function (e) {
E.preventdefault && E.preventdefault ();
E.returnvalue=true;
E.stoppropagation && e.stoppropagation ();
return true;
}
}
Or
Bgdom.removeeventlistener (' Touchmove ', fscrollfix,false);

Bgdom is the background Layer DOM object, this scenario is unsuccessful for the author's experiment

Reference: http://segmentfault.com/q/1010000003089816

Http://www.w3cfuns.com/article-5600528-1-1.html

http://zhangzhaoaaa.iteye.com/blog/2105145

Summary of scrolling penetration of mobile-side pop-up layers

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.