Website mobile version development Tread pit record four

Source: Internet
Author: User

Foreplay: Halo is sleepy, the test sister paper to take an ipad, open a micro-blog, opened the site said you see, micro-blog with browser Click to enlarge the Web page is not adaptive AH (website because there are pictures of God horse, the whole station picture to adapt to all kinds of mobile devices), I woke up, thought I grass this is what function, When people like me who have ipads have seen this feature.

Well, since there's been a problem, start thinking about it---continue to coma for 10 minutes ....

Start: Take the ipad probably looked at, when the micro-Bo opened, in fact, the page is still a little redundant blank width, since made a 80% (estimate) of the visual display area, but still can be useful to move to leave a blank, and then click to enlarge, the page Tile this window, the first thought must not be adjusted my redraw code , but the experience of the exhibition area, it does not need to adjust (I re-adjust the page, listening to the first page rotation, otherwise resize) so resize not bound events, since it is just the ipad Weibo is so, first confirm the ipad Weibo useragent bar And looked at the fruit of a mozilla/5.0 (IPAD; CPU os 5_1_1 like Mac os X applewebkit/534.46 (khtml, like Gecko) mobile/9b206 ipad1,1__weibo__3.5.1__ipad__os5.1.1 roar that's you. The

var iPad = navigator.userAgent.toLowerCase().match(/iPad/i);   var isIpadWeibo = null;if(iPad) {    var isIpadWeibo = navigator.userAgent.toLowerCase().match(/_weibo_/i);}

So as long as the judgment is Isipadweibo, then I'll bind the event once.

if(isIpadWeibo) {    $(window).on(‘resize‘, function() {        //js调整图片自适应代码    }); }

Problem solving.

Related Article

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.