Mobile End Page Summary

Source: Internet
Author: User

Not long ago, to do the mobile side of the demand, mobile is really a lot of pits, below I recorded the problem I encountered:

1, the height of the full screen needs to add the following style:

html{height:100%;};

2, official website Zepto.js The default does not support the animate function, needs to have the choice to add the plug-in, the URL is as follows:

http://github.e-sites.nl/zeptobuilder/

3, Zepto.js does not support scrolltop (return to the top of the smooth effect), you need to write down the JS effect:

Method one of the following code:

functionScroll (selector, animate, Viewoffset) {$ (' body '). Scrolltobottom (0, ' 200 '); }    $('. Go_top '). Click (function(e) {e.preventdefault (); Scroll ($ (' #wrap '),true, 30 );    }); $.fn.scrolltobottom=function(scrollheight, duration) {var$el = This; varel = $el [0]; varStartPosition =El.scrolltop; varDelta = scrollheight-startposition; varStartTime =Date.now (); functionScroll () {varfraction = Math.min (1, (Date.now ()-startTime)/duration); El.scrolltop= Delta * fraction +startposition; if(Fraction < 1) {setTimeout (scroll,10);    }} scroll (); };

Method Two follows the code:

functionScroll (scrollTo, time) {varScrollfrom =parseint (DOCUMENT.BODY.SCROLLTOP), I= 0, Runevery= 5;//Run every 5msScrollTo =parseint (ScrollTo); time/= Runevery;varInterval = SetInterval (function() {i++; Document.body.scrollTop= (Scrollto-scrollfrom)/time * i +Scrollfrom; if(I >=Time )            {clearinterval (interval);    }}, Runevery); }    $('. Go_top '). Click (function() {Scroll (' 0 ', 200); });

Return to the top button to hide the display code:

$ (window). Scroll (function() {        if(window). scrolltop () >100) {            $ ( ". Go_top"). Removeclass ("none");        }         Else {            $ (". Go_top"). AddClass ("none");        }    })

4, <input type= "text"/> text box input text does not wrap, to realize the line-wrapping effect can be replaced with Div, the code is as follows:

<div class= "fl evalute_txt" contenteditable= "true"></div>

5, if only a few columns of the situation, you can use the Display:-webkit-box attribute, if the column width of each row is not the same, resulting in ataxia.

These are some of the most impressive questions that will be added later.

Mobile End Page Summary

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.