iphone手机端图片错位修正的js代码

<script type="text/javascript">
     $(function(){
           // 获取终端的相关信息
                var Terminal = {
                // 辨别移动终端类型
                platform : function(){
                var u = navigator.userAgent, app = navigator.appVersion;

                return {
                // android终端或者uc浏览器
                android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1,
                // 是否为iPhone或者QQHD浏览器
                iPhone: u.indexOf('iPhone') > -1 ,
                // 是否iPad
                iPad: u.indexOf('iPad') > -1,
                                    // 是否是通过微信的扫一扫打开的
                weChat: u.indexOf('MicroMessenger') > -1,

                isiOS9: Boolean(u.match(/OS [9]_\d[_\d]* like Mac OS X/i))
                                    
                };
                }(),
                // 辨别移动终端的语言:zh-cn、en-us、ko-kr、ja-jp...
                // language : (navigator.browserLanguage || navigator.language).toLowerCase()
                }
            $("#showinandroidbrowser").hide();
            $("#showiniosbrowser").hide();
            $("#ss1").attr("src","images/xzai1-1.jpg");
            $("#ss2").attr("src","images/xzai2.jpg");
            $("#ss3").attr("src","images/xzai3.jpg");
            $("#showiniosbrowser").css("height",jQuery(window).height());
            $("#showinandroidbrowser").css("height",jQuery(window).height());
             $(".swiper-container").css("height",jQuery(window).height()*13/15);
            
        
            
        if(Terminal.platform.android){
            $("#download").attr("src","images/android.jpg");
            $("#downloadurl").attr("href","http://download.chinahrt.com/app/rx_v3_2_2_20151014092004_CHINAHRT.apk");
            if(Terminal.platform.weChat) {
                //在浏览器中打开
                $("#showinandroidbrowser").show();
                $("#showiniosbrowser").hide();
            }
        } else if(Terminal.platform.iPhone || Terminal.platform.iPad ){
            $("#downloadurl").attr("href","itms-services://action=download-manifest&url=https://m.chinahrt.com/rongxue/iphone/rxios_1.0.34.plist");
            $("#download").attr("src","images/ios.png");
            if(Terminal.platform.weChat){
                //在safari中打开
                 $("#showiniosbrowser").show();
                 $("#showinandroidbrowser").hide();
            }else{
                if(Terminal.platform.isiOS9){
                    //iOS9的使用教程
                    $("#showiniosbrowser").hide();
                    $("#showinandroidbrowser").hide();
                    $(".swiper-container").show();
                    $("#ss1").attr("src","images/02.jpg");
                    $("#ss2").attr("src","images/03.jpg");
                    $("#ss3").attr("src","images/04.jpg");
                     $(".swiper-container").css("height",jQuery(window).height());
                    
                    
                    $("#ss3").click(function(){
                        $("#ss1").attr("src","images/xzai1-1.jpg");
                        $("#ss2").attr("src","images/xzai2.jpg");
                        $("#ss3").attr("src","images/xzai3.jpg");
                        mySwiper.swipeTo(0,1,false);
                        $("#ss3").unbind("click");
                        $("#download").show();
                        $(".swiper-container").css("height",jQuery(window).height()*13/15);
                        
                    });
                    $("#download").hide();

                }
            }
        }

    
     

});
    
     

    </script>

 

posted @ 2015-11-09 11:42  段干木  阅读(864)  评论(0编辑  收藏  举报