<span id="Label3"> </p>1, ios Fixed in the input or textarea, the user entered text, trigger the keyboard, the fixed container will be centered, rather than continue to hover solution: http:// dwz.cn/crwnz2, Mobile Click Time 300ms delay workaround: zepto.js or Baidu Touch.js or fastclick.js3, Zepto Touch Problem: Swipe event in Xiaomi 1 and other low-end phones do not support the basic use of zepto4, Baidu's touch.js through the Touch.on to bind events, but click will encounter a point through the problem, that is, the parent trigger, child trigger Workaround: Download the latest version of touch address:http://touch.code.baidu.com/ through the latest API ev.originevent.preventdefault (); before a bit of a problem-solving solution, with Touchend or touchstar, can be, But there is no consideration of the user in a sliding screen when the finger just touched this button or just in this button finger left, it will trigger this button event, so this method is not very reasonable, is often a click on the trigger is not a touch let him trigger. 5, Select dropdown box of the high problem, mobile phone display style is not the same, in the QQ browser pop-up option list height and select as high, in the HTC phone comes with the browser, height setting higher, You can not use option to select the required parameter value, Option default display of the first has a background 6, on the ipod, iphone4 does not support through the tap to trigger the event audio js, such as can not be triggered by the src change the sound playback, with Click to Solve. 7, Mobile audio in the Apple phone does not support music automatic playback, Apple has a security mechanism, users need to manually trigger to play music, which is now a lot of one screen sliding items to add a music icon is not simply to let the user to turn off the music, Speculation is that the user hand trigger to the screen when the execution of Id.play (), the JS8, the form does not say, such as the upload button set the background image is invalid, are through the opacity for the 9 of the simulation of the zero, Many people use the fullpage.js to achieve large-picture scrolling or a one-screen screen, but in the development of the use of thisPlug-ins If you do not set anchors to define the anchor point, the public number of published articles with the link parameter has the # number, without adding anchors, will appear roll to the second screen user exit continue to jump to the second page immediately after the Problem. solution: anchors: [' page1 ', ' page2 ', ' page3 ', ' page4 '],10, recommend the use of swiper.js for development, better Chinese API website is:/http Www.swiper.com.cn/can solve a lot of mobile problems, 11, the Apple system in the rolling long page is always rolling very uncomfortable, not neat, rebound effect, plus a code:-webkit-overflow-scrolling:touch;12, Video Default controller hidden: video::-webkit-media-controls-enclosure {display:none!important;}, There is video on the mobile side can set the first frame screen, But some phones, such as HTC Default is a gray background, the solution is just to get a picture on top, Click on the time when the picture disappears trigger play, Virgo just do So. 13, PNG image compression is a headache, the effect is not good, you can try this site: https://tinypng.com/ many people know that JPG can adjust the quality, but do not know that PNG can be so compressed, the best effect of a Site. Now there is a lower-quality webp format diagram, google developed, Android phone test can be, apple phone Not. Do not use, you can understand. Can see the smart map: http://zhitu.tencent.com/14, can use the font icon with the font icon, IE6 can be compatible with the mobile side afraid of what? http://www.iconfont.cn/ 15, CSS3 Animation effect can refer to Animate.css written very good: http://daneden.github.io /animate.css/ Some low-end mobile phone more dazzling effect directly have before, no intermediate effect, mobile phone card out of xiang, not Supported. 16, Understand Viewport.js people, if you encounter some mobile phone scaling small, jquery will be put to viewport reference before, there is meta tag, need to pay attention to width=device-width, GitHub address: https:// github.com/anatoo/viewport.js Use PX to cut the mobile end, pc-side how to cut your mobile side also follow the cut, but generally less use, viewport will appear some problems, the project is more urgent to use 17, the mobile side with rem, don't use the old-fashioned em, 18, Apple mobile phones are aware that mobile phone numbers will disappear, add code bar:< metacontent= "telephone=no" name= "format-detection"/> Ignore mailbox recognition, add code bar:<meta content= "email=no" name= "format-detection" />19, good tired, first sleep another day to add ..... the following mobile content from csdn bo friends toothpaste Finishing: "<strong><strong>the problem and solution of making mobile phone web half-year</strong></strong>》<p><p>First of all, It is a template page that I will use for each project, a HTML file that I have defined after I met a big, small hole.</p></p><p><p></p></p><strong><strong>[html]</strong></strong>View Plaincopy <ol class="dp-xml" start="1"> <li class="alt"><li class="alt"><! DOCTYPE HTML<span class="tag">></span></li></li> <li><li><span class="tag"><<span class="tag-name">html<span class="tag">></span> </span></span></li></li> <li class="alt"><li class="alt"><span class="tag"><<span class="tag-name">head<span class="tag">></span> </span></span></li></li> <li><li><span class="tag"><<span class="tag-name">meta <span class="attribute">charset=<span class="attribute-value">"utf-8" <span class="tag">/></span> </span> </span> </span> </span></li></li> <li class="alt"><li class="alt"><span class="comments"><!--width is set to the actual device width, the initialization multiplier is 1, the minimum multiplier is 1, the maximum multiplier is 1, the user is scaled to no</span> --</li></li> <li><li><span class="tag"><<span class="tag-name">meta <span class="attribute">name=<span class="attribute-value">"viewport" <span class="attribute">content= "<span class="attribute-value">width=device-width,inital-scale=1.0,minimum-scale=1.0, Maximum-scake=1.0,user-scalable=no " <span class="tag">/></span> </span> </span> </span> </span> </span> </span></li></li> <li class="alt"><li class="alt"><span class="comments"><!--delete The default Apple toolbar and menu bar--</span></li></li> <li><li><span class="tag"><<span class="tag-name">meta <span class="attribute">name=<span class="attribute-value">"apple-mobile-web-app-capable" <span class="attribute">content=<span class="attribute-value">"yes" <span class="tag">/></span> </span> </span> </span> </span></span></span></li></li> <li class="alt"><li class="alt"><span class="comments"><!--the top of the Apple phone is black--</span></li></li> <li><li><span class="tag"><<span class="tag-name">meta <span class="attribute">name= "<span class="attribute-value">apple-mobile-web-status-bar-style" <span class="attribute">content=<span class="attribute-value">"block" <span class="tag">/></span> </span></span></span></span></span></span></li></li> <li class="alt"><li class="alt"><span class="comments"><!--screen Browser automatically recognizes numbers as phone numbers--</span></li></li> <li><li><span class="tag"><<span class="tag-name">meta <span class="attribute">name= "<span class="attribute-value">fromat-detecition" <span class="attribute">content=<span class="attribute-value">"telephone=no" <span class="tag">/></span> </span> </span> </span> </span></span></span></li></li> <li class="alt"><li class="alt"><span class="comments"><!--base.css is the underlying style that all projects use--</span></li></li> <li><li><span class="tag"><<span class="tag-name">link <span class="attribute">rel=<span class="attribute-value">"stylesheet" <span class="attribute">type=<span class="attribute-value">"text/css" <span class="attribute">href=<span class="attribute-value"> <span class="tag">"css/base.css"/> </span></span></span></span></span></span></span></span></span></li></li> <li class="alt"><li class="alt"><span class="comments"><!--content.css is a common style that is used on all pages of each project--</span></li></li> <li><li><span class="tag"><<span class="tag-name">link <span class="attribute">rel=<span class="attribute-value">"stylesheet" <span class="attribute">type=<span class="attribute-value">"text/css" <span class="attribute">href=<span class="attribute-value"> <span class="tag"></span> "css/content.css"/> </span></span></span></span></span></span></span></span></li></li> <li class="alt"><li class="alt"><span class="comments"><!--main.css a style file for each page or module-</span> -</li></li> <li><li><span class="tag"><<span class="tag-name">link <span class="attribute">rel=<span class="attribute-value">"stylesheet" <span class="attribute">type=<span class="attribute-value">"text/css" <span class="attribute">href=<span class="attribute-value"> <span class="tag"></span> </span> "css/main.css"/> </span></span></span></span></span></span></span></li></li> <li class="alt"><li class="alt"><span class="tag"><<span class="tag-name">title<span class="tag">><span class="tag"></<span class="tag-name">title<span class="tag">></span> </span> </span> </span> </span> </span></li></li> <li><li><span class="tag"><<span class="tag-name">script <span class="attribute">type=<span class="attribute-value">"text/javascript" <span class="attribute">src=<span class="attribute-value">"lib/jquery-1.8.2.min.js"<span class="tag">><span class="tag"></ <span class="tag-name"> Script<span class="tag">></span> </span> </span> </span> </span> </span> </span> </span> </span> </span></li></li> <li class="alt"><li class="alt"><span class="comments"><!--base.js js file for all projects-</span> -</li></li> <li><li><span class="tag"><<span class="tag-name">script <span class="attribute">type=<span class="attribute-value">"text/javascript" <span class="attribute">src=<span class="attribute-value">"lib/base.js"<span class="tag">><span class="tag"></<span class="tag-name">script<span class="tag">> </span></span></span></span></span></span></span></span></span></span></li></li> <li class="alt"><li class="alt"><span class="tag"></<span class="tag-name">head<span class="tag">></span> </span></span></li></li> <li><li><span class="tag"><<span class="tag-name">body<span class="tag">></span> </span></span></li></li> <li class="alt"><li class="alt"><span class="tag"></<span class="tag-name">body<span class="tag">></span> </span></span></li></li> <li><li><span class="tag"></<span class="tag-name">html<span class="tag">></span> </span></span></li></li> </ol><p><p></p></p><p><p>The meta above can help me avoid all the good questions.</p></p><p><p>Problems encountered:</p></p><p><p>1. On the Apple phone, the input control will have a default style</p></p><p><p>Solve</p></p><p><p></p></p><strong><strong>[html]</strong></strong>View Plaincopy <ol class="dp-xml" start="1"> <ol class="dp-xml" start="1"> <li class="alt">/* Remove the default style of the Apple Mobile Web button and fix the default fillet of the button */</li> <li>input[<span class="attribute">type=<span class="attribute-value">"button"]{-webkit-appearance:none;/* Remove input default style *//*border-radius:0px;*/}</span> </span></li> </ol> </ol>2. When you click on the a tag, the Android phone will have a blue bottom, and the Apple will have a gray bottom.<p><p></p></p><p><p>Solve</p></p><p><p></p></p><strong><strong>[html]</strong></strong>View Plaincopy <ol class="dp-xml" start="1"> <ol class="dp-xml" start="1"> <li class="alt">/* Shield click Element to show background */</li> <li>A</li> <li class="alt">{</li> <li>-webkit-tap-highlight-color:rgba (255,255,255,0);</li> <li class="alt">}</li> </ol> </ol>3. Disable text selection on the page<p><p></p></p><p><p>Solve</p></p><p><p></p></p><strong><strong>[html]</strong></strong>View Plaincopy <ol class="dp-xml" start="1"> <ol class="dp-xml" start="1"> <li class="alt">-webkit-user-select:none;</li> </ol> </ol>4. The structure of the right text is realized by the left Image.<p><p></p></p><p><p></p></p><p><p>This structure</p></p><p><p>(1). the first time to do, the left and right two pieces are used hundred percent, so in different screen because the right font cause there will be layout confusion, and then use the media query to write more than two style files, but there is one is on the flat, the same hundred, the picture on the left is too large, resulting in the right of the text between the spacing to be very large to align, the effect is very Not good</p></p><p><p>(2). the second time to do, I think of a method, the use of float out of the document flow characteristics, to set a maxwidth picture, but in the device-width* picture hundred =maxwidth, The text is located in the div of the float set to None , and set Margin-left to the width of the picture and the spacing between them.</p></p><p><p>(3). the third time to do, because looked at some other light app in the horizontal screen, the picture size is still the same, so the width of the picture to die, to a max-width and min-width, with flexible layout flex-box, This back is very simple height this layout problem</p></p><p><p>5. In the UC open page there will be a cache problem, resulting in sometimes the small effect of changes can not see</p></p><p><p>Fix: here try to use the cache to not let it cached, but after the use of it instead of loading the file (so far has not successfully used the cache), and finally load the sending request when the file after adding multiple random number, so that the test is to solve the problem of caching</p></p><p><p>6. In the mobile phone page, a lot of time will be used to z-index this property, if the use of this property and then set the corresponding elements, will be more prone to chaos.</p></p><p><p>Fix: I set up a</p></p><p><p>top0{z-index:9999};</p></p><p><p>top1{z-index:8888};</p></p><p><p>top2{z-index:7777};</p></p><p><p>top3{z-index:6666};</p></p><p><p>top4{z-index:5555};</p></p><p><p>This way, on each page, the corresponding style is affixed to the LINE.</p></p><p><p>7. There is also a multi-column layout column, flexible layout Flex-box</p></p><p><p>In the case of these two layouts, the following layout is more troublesome, especially three columns, and the middle one has left and right borders, the definition of hundred times more Trouble.</p></p><p><p>When you know the multi-column layout column, the elastic layout flex-box after the problem is well solved, but remember that the column of the child elements to give height, otherwise it may be layout confusion</p></p><p><p>Another problem is that when you set Column-count to 3, That's What happens when you have 7 child Elements.</p></p><p><p>Vertical arrangement, not in line with a normal reading habit, and finally changed to float to layout</p></p><p><p>The difference between 8.em and REM</p></p><p><p>EM is relative to the parent layer</p></p><p><p>REM is relative to the root element</p></p><p><p>So say, if html{font-size:62.5%};</p></p><p><p>If you set the 1.5em,child setting at the parent element, the 1.0em is equivalent to the 1.5em of Html.</p></p><p><p>In the case where the parent element is set to 1.5em, the child uses REM as the unit of the font-size, then it is necessary to set 1.5rem to be equal to the above Effect.</p></p><p><p>9.backgrond-size, This property is very useful</p></p><p><p>The usage has A. hundred percent B. directly to the width of the high c.cover d.contain four kinds of usage, choose to use as required</p></p><p><p>10. In the iphone, the font will become larger by default when the phone is changed to Flat screen mode</p></p><p><p>Solve:</p></p><p><p>/* font size will be larger when you disable iOS horizontal screen */<br>-webkit-text-size-adjust:none;</p></p><p><p>11. In the use of <div></div> This structure, is to use block-level elements to wrap img, will appear div height is greater than img case, is a bit highly do not know how to solve: img{ display:block;};</p></p><p><p>12. In the use of media, if the <meta> has set width=device-widht, media in the settings max-width min-width, here can not use max-device-width and min-device-height, or it'll be no effect.</p></p><p><p>13. Currently mobile phone web can not disable the mobile phone horizontal screen, If you have a problem with the layout of the page, the horizontal screen will appear when the layout of the chaotic situation</p></p><p><p>Solve</p></p><p><p>Pop a layer on the horizontal screen to correct Him.</p></p><p><p>For example</p></p><p><p></p></p><strong><strong>[html]</strong></strong>View Plaincopy <ol class="dp-xml" start="1"> <ol class="dp-xml" start="1"> <li class="alt">/* @media screen and (orientation:landscape)</li> <li>{</li> <li class="alt">. orientation-phone</li> <li>{</li> <li class="alt">display:block;</li> <li>}</li> <li class="alt">}*/</li> <li>/* page Cover Layer */</li> </ol> </ol>14. When the full screen div is ejected, if the overall page is larger than one screen, the page can scroll when the page appears next to the scroll bar, and can be dragged<p><p>Solution: set height at body 100%, and overflow-hidden; remove Overflow-hidden when eject disappears;</p></p><p><p>15. When making a mobile web project, we should summarize the font size of the following page, then define several common font-size to prevent Post-chaos</p></p><p><p>16. when looking at the design draft, pay attention to scaling, because the UI is done with the size of 640*1136 (at least my side is this), and then do the mobile web, we mate there content settings width=device-width, therefore, according to the actual page effect to define the page commonly used font-size size and other. You cannot set font-size by the font size given by the Ui.</p></p><p><p>17. on the reverse side of class, use less inheritance, multiple combinations, which can speed up development efficiency and define an underlying style base.css (common styles and so projects can be shared)</p></p><p><p>18. may do the mobile phone web to go to school mobile Web development framework, for example, I learned the jquery mobile, this framework is very powerful, but do not say, is in the UI style is more troublesome, to continue to cover the style, if your web is the UI has its own characteristics, This is a time to spend with jquery mobile (at least I do). So in the development of the time, think which method is used quickly, not to use the framework and Frame.</p></p>Split Line ************************************************ ************************************<p><p>The following specifications are recommended, are <code>Alloyteam</code> summarized in the daily development process of refining the experience, the specification has a good project practice, strongly recommend the use of</p></p>Font settings<p><p>Use sans serif fonts</p></p><pre name="code" class=" language-css"><pre name="code" class=" language-css"><code class=" language-css"><span class="token selector">body <span class="token punctuation">{ <span class="token property">font-family<span class="token punctuation">: <span class="token string">"Helvetica Neue", Helvetica, STHeiTi, sans-serif<span class="token punctuation">;<span class="token punctuation">}</span></span></span></span></span></span></span></code></pre></pre><p><p>iOS 4.0+ uses the English font Helvetica Neue, before the iOS version is degraded using Helvetica. The Chinese font is set to Chinese blackbody stheiti. It should be added that the Chinese blackbody does not exist in the iOS font library (http://support.apple.com/kb/HT5878), But the system will automatically hit the Chinese blackbody Stheiti compatible with the system default English font blackbody-simple or Bold-complex</p></p><pre name="code" class="prettyprint"><pre name="code" class="prettyprint"><span class="typ">Heiti light<span class="pln"><span class="typ"> <span class="pln"><span class="pun">blackbody-simple <span class="pln"><span class="pun">thin body <span class="pln">(after IOS 7 discarded)<span class="typ">heiti<span class="pln"><span class="typ">Medium <span class="pln"><span class="pun">blackbody-jane <span class="pln"><span class="pun">black <span class="pln"><span class="typ">heiti light<span class="pln"><span class="typ"> <span class="pln"><span class="pun">Blackbody-complex <span class="pln"><span class="pun">fine body <span class="pln"><span class="typ">heiti<span class="pln"><span class="typ">Medium <span class="pln"><span class="pun">blackbody- <span class="pln"><span class="pun">medium black</span></span> </span></span> </span></span> </span></span> </span></span> </span></span> </span></span> </span></span> </span></span> </span></span> </span></span> </span> </span> </span></span></span></span></span></span></span></pre></pre><p><p>Native Android Chinese fonts and English fonts are selected by default sans serif font</p></p><pre name="code" class="prettyprint"><span class="lit">4.0<span class="pln"> <span class="pun">Previous version English font native<span class="pln"> <span class="typ">Android<span class="pln"><span class="pln"> <span class="pun"> using <span class="pln"> <span class="typ">droid<span class="typ" <span>sans<span class="pln" , chinese font native <span> <span class="typ">android<span class="pln"> Span class= "pun" > will hit <span class="pln"> <span class="typ">droid<span class="pln"> <span class="typ">sans <span class="pln"> <span class="typ">fallback<span class="pln"><span class="lit">4.0<span class="pln" <span and both english chinese fonts will use native> <span class="typ">android<span class="pln"> <span class="pun"> New <span class="pln"> <span class="typ">roboto<span class="pln"> <span class="pun"> font <span class="pln"> <span class="pun"> Other third party <span class="pln"> <span class="typ">android<span class="pln"> <span class="pun"> The system also chooses the default sans serif font </span> </span> </span> </span> </span> </span> </span> </span> </span> </span> </span> </span> </span> </span> </span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span> </span></span></span></span></span></span></pre>Basic interaction<p><p>Set the global CSS style to avoid long pressing of the pop-up menu and the selected text in the diagram</p></p><pre name="code" class=" language-css"><pre name="code" class=" language-css"><code class=" language-css"><span class="token selector">a, img <span class="token punctuation">{ <span class="token property">-webkit-touch-callout<span class="token punctuation">: none<span class="token punctuation">; <span class="token comment">/* 禁止长按链接与图片弹出菜单 */<span class="token punctuation">}<span class="token selector">html, body <span class="token punctuation">{ <span class="token property">-webkit-user-select<span class="token punctuation">: none<span class="token punctuation">; <span class="token comment">/* 禁止选中文本(如无文本选中需求,此为必选项) */ <span class="token property">user-select<span class="token punctuation">: none<span class="token punctuation">;<span class="token punctuation">}</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></code></pre></pre><p><p></p></p>Mobile performance to consider<code><code>Android</code></code>Low-end machines and<code><code>2G</code></code>Performance under Network scenarios<span class="label label-danger"><span class="label label-danger">Watch out! </span></span><p><p>Required checks before publishing</p></p> <ul> <ul> <li>All pictures must have been compressed</li> <li>Consider moderate lossy compression, such as JPG images converted to 80% quality</li> <li>Consider cutting large images into multiple small plots, which are common in banner Plots.</li> </ul> </ul><p><p>Load performance optimization to open fast enough</p></p> <ul> <ul> <li>Data offline, Consider caching data in Localstorage</li> <li>Initial request resource Count <code>< 4</code> <span class="label label-danger">note! </span></li> <li>Images using CSS Sprites or Datauri</li> <li>Avoid @import introduction in the outer chain CSS</li> <li>Consider embedding small, static resource content</li> <li>Initial request Resource Gzip total volume<code>< 50kb</code></li> <li>is static resource (html/css/js/image) optimized for compression?</li> <li>Avoid packaging large class libraries</li> <li>Ensure that the access layer has gzip compression turned on (consider upgrading the gzip level, using CPU overhead in exchange for load Time) <span class="label label-danger">note! </span></li> <li>Try to use CSS3 instead of pictures</li> <li>Static resource (js/css) delay loading outside of initial first screen <span class="label label-danger">note! </span></li> <li>Image resources other than the initial splash screen load on Demand (judging the viewable Area) <span class="label label-danger">note! </span></li> <li>Single page application (SPA) consider delaying loading of non-first-screen business modules</li> <li>Turn on keep-alive link multiplexing</li> </ul> </ul><p><p>Operational performance optimization to achieve smooth enough operation</p></p> <ul> <ul> <li>Avoid IOS 300+ms Click Delay Issues <span class="label label-danger">note! </span></li> <li>Cache DOM Selection and calculation</li> <li>Avoid triggering page redraw actions</li> <li>Debounce continuously triggered events (scroll/resize/touchmove, etc.) to avoid high frequent triggering of execution <span class="label label-danger">attention! </span></li> <li>Avoid Bulk-bound events by using event proxies whenever possible</li> <li>Use CSS3 animations instead of JS animations</li> <li>Avoid using a large number of CSS3 gradient shadows on low-end machines to improve fluency by considering the downgrade effect</li> <li>HTML hierarchy remains simple enough</li> <li>Use the CSS Advanced selector and the wildcard selector as little as possible</li> <li>Keep it simple</li> </ul> </ul><p><p>Mobile HTML5 Development Experience (turn)</p></p></span>
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