Summary of scrolling practices for mobile content areas

Source: Internet
Author: User

Own a summary of some of the methods, if there are any new good ways to communicate:

1. Give positioning (navigation bar) (bottom)

nav{

position:fixed;

Top:0rem;

};

footer{

position:fixed;

Bottom:0rem;

};

However, this method will have drawbacks, when you set the NAV, the content area will be the head, you need to set the content area to set the top value nav to the height of the side.

2. Use the Iscroll plugin.

For example:

      

<! DOCTYPE html>
<meta charset= "Utf-8"/>

<meta name= "viewport" content= "width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1, User-scalable=no "/>
<title></title>
<style type= "Text/css" >
*{
margin:0;
padding:0;

List-style:none;
}
body,html{
width:100%;
height:100%;
Overflow:hidden;
}
nav{
Font-weight:bold;
Color:white;
Text-align:center;
width:100%;
Height:3rem;
Line-height:3rem;
Background:black;
}
footer{
Text-align:center;
Color:white;
Font-weight:bold;
Line-height:3rem;
width:100%;
Height:3rem;

}
. wrap{
width:100%;
height:100%;
Overflow:auto;
}

UL li{
width:100%;
Height:5rem;
Line-height:5rem;
}
footer{
Bottom:0rem;
Position:absolute;
Height:3rem;
Background:firebrick;
}
</style>
<body>
<nav> Head Navigation </nav>
<div class= "Wrap" >
<!--<div class= "box" >-->
<ul>
<li> I am content area </li>
<li> I am content area </li>
<li> I am content area </li>
<li> I am content area </li>
<li> I am content area </li>
<li> I am content area </li>
<li> I am content area </li>
<li> I am content area </li>
<li> I am content area </li>
<li> I am content area </li>
<li> I am content area </li>
<li> I am content area </li>
<li> I am content area </li>
<li> I am content area </li>
<li> I am content area </li>
<li> I am content area </li>
</ul>
<!--</div>-->
</div>
<footer>
Bottom
</footer>
</body>
<script src= "Js/iscroll-probe.js" type= "Text/javascript" charset= "Utf-8" ></script>
<script src= "Js/jquery-2.1.4.min.js" type= "Text/javascript" charset= "Utf-8" ></script>
<script type= "Text/javascript" >
var a =new iscroll (". Wrap", {

})
</script>

3. The third Kind of flexible box: The disadvantage (will change the height of NAV);

  

<! DOCTYPE html>
<meta charset= "UTF-8" >
<title></title>
<meta name= "viewport" content= "width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1, User-scalable=no "/>
<style type= "Text/css" >
*{
margin:0;
padding:0;
}
body,html,.wrap{
width:100%;
height:100%;
Overflow:hidden;
Display:flex;
Flex-grow:1;
Flex-direction:column;
}
. box{
width:100%;
Overflow:auto;
}
nav{
width:100%;
Height:3rem;
Line-height:3rem;
Background:black;
Color:white;
Font-weight:bold;
Text-align:center;
}
footer{
Text-align:center;
width:100%;
Height:3rem;
Line-height:3rem;
Color:white;
Font-weight:bold;
Background:firebrick;
}
. Box UL li{
width:100%;
Height:5rem;
Line-height:5rem;
}
</style>
<body>
<div class= "Wrap" >
<nav> Head </nav>
<div class= "box" >
<ul>
<li> Content Area </li>
<li> Content Area </li>
<li> Content Area </li>
<li> Content Area </li>
<li> Content Area </li>
<li> Content Area </li>
<li> Content Area </li>
<li> Content Area </li>
<li> Content Area </li>
<li> Content Area </li>
<li> Content Area </li>
<li> Content Area </li>
</ul>
</div>
<footer> Bottom </footer>
</div>
</body>

  

If there are other good ways, hope to communicate together;

Summary of scrolling practices for mobile content areas

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.