Mobile page size fixed area scrolling/overflow:auto scroll bar not displayed on mobile side

Source: Internet
Author: User

Mobile Web page, to realize the function, the piece

Initial idea, use DL to set a fixed width to DL and then scroll through the full content with Overflow:auto settings

Problem 1: Scroll bar does not display, but can scroll normally,

Solutions

<span style= "Font-family:microsoft yahei;font-size:18px;color: #333333;" >/*--scroll bar--*/::-webkit-scrollbar{width:5px; height:5px background-color: #fff;}::-webkit-scrollbar:hover{ Background-color: #eee; }::-webkit-resizer{}::-webkit-scrollbar-thumb{-webkit-border-radius:4px; Background-color: #ccc; height:10px;}::- webkit-scrollbar-thumb:hover{background-color: #aaa;}::-webkit-scrollbar-thumb:active{background-color: #888;} </span>
Problem 2: When the function of this method is sliding to the bottom of the block, the entire page is sliding upward

Workaround: Use the Iscroll plugin to scroll

HTML code

<span style= "Font-family:microsoft yahei;font-size:18px;color: #333333;" ><div class= "wrapper" ><dl id= "scroller" ><dt> all business district </dt><dd> business district 1</DD><DD > 1</dd><dd> Commercial Zone, 1</dd><dd> commercial district, 1</dd><dd> District, 1</dd><dd> commercial area 1</DD 1</dd><dd>, 1</dd><dd> business district, 1</dd><dd> Commercial district, 1</dd><dd> commercial area, ><dd> business district Commercial Area 1</dd><dd> Commercial district 1</dd><dd> 1</dd><dd> Shang District 1</dd><dd> Shang District 1</dd> 1</dd></dl></div></span>, 1</dd><dd> Commercial District, 1</dd><dd> commercial area, <dd> business district
CSS Code
<span style= "Font-family:microsoft yahei;font-size:18px;color: #333333;" >.wrapper{position:relative; left:0; top:40px; width:40%; height:150px; overflow:hidden;}. Wrapper dl{Position:absolute;} </span>
JS Code

<span style= "Font-family:microsoft yahei;font-size:18px;color: #333333;" ><script type= "Text/javascript" src= "js/iscroll.js" ></script><script type= "Text/javascript" > var myscroll;function loaded () {myscroll = new Iscroll ('. Wrapper ', {scrolly:true, scrollbars:true});} Document.addeventlistener (' Touchmove ', function (e) {E.preventdefault ();}, False);</script></span>

Perfect solution!


Mobile page size fixed area scrolling/overflow:auto scroll bar not displayed on 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.