소스 검색

修改为苹果适配

李雪梅 2 년 전
부모
커밋
3a368fb3b9

+ 16 - 13
nngkxxdp/src/main/resources/static/district/css/sy_mobile_new.css

@@ -21,20 +21,20 @@ a {
 }
 .left-logo {
 	/* width: 446px; */
-	margin: 2.26666vw 0 2.26666vw 3.2vw;
+	margin: 9px 0 9px 12px;
 }
 .left-logo a{
 	width: 100%;
 }
 .logo-img {
 	/* width: 100%; */
-	height: 7.33333vw;
+	height: 28px;
 }
 .right_logo{
     margin: 2.26666vw 3.2vw 2.26666vw 0;
 }
 .right_logo img{
-	height: 7.33333vw;
+	height: 28px;
 }
 /* html,body{
 	position: relative;
@@ -59,11 +59,11 @@ a {
     background-color: white;
     /* overflow-y: auto; */
     /* overflow-x: hidden; */
-	margin-top: 14.93333vw;
+	margin-top: 50px;
 }
 .right-map {
     width: 73%;
-	height: 290px;
+	height: 260px;
     overflow: hidden;
     width: 100%;
 }
@@ -380,21 +380,21 @@ a {
 	width: 90%;
 	overflow-y: auto;
 	overflow-x: hidden;
-	height: 82.86666vw;
-	position: absolute;
-	left: 0;
-	top: 0;
+	height: 84.86666vw;
+	position: relative;
 	background: #F3F3F3;
+	margin: 0 auto;
+	padding-top: 4.5vw;
 }
 .wrap_result1{
 	width: 90%;
 	overflow-y: auto;
 	overflow-x: hidden;
-	height: 82.86666vw;
-	position: absolute;
-	left: 0;
-	top: 0;
+	height: 84.86666vw;
+	position: relative;
 	background: #F3F3F3;
+	margin: 0 auto;
+	padding-top: 4.5vw;
 }
 .pad_box{
 	width: 100%;
@@ -540,6 +540,9 @@ a {
 	padding: 3.46666vw 4.26666vw;
 	margin-bottom: 2.53333vw;
 }
+.titleFirst:last-child{
+	margin-bottom: 6.53333vw;
+}
 .btn_box{
 	display: flex;
 	justify-content: space-around;

+ 45 - 87
nngkxxdp/src/main/resources/static/district/js/sy_mobile.js

@@ -64,7 +64,7 @@ $(function () {
     $.ajax({
         type: 'GET',
         url: PATH + '/mapdata/getMapDataAll',
-		// url: "http://192.168.0.230:7777/mapdata/getMapDataAll",
+		// url: "http://192.168.1.253:7777/mapdata/getMapDataAll",
         async: false,
         success: function (res) {
             $.each(res.data.xxs, function(i){
@@ -402,20 +402,38 @@ $(function () {
 
     // 渲染点击小学等的结果页面样式
     function applyClickList(){
-        $('.show-first').hide();
-        // $('.show-fifth').show();
-        $('.show-fifth').fadeIn(500);
-        $('.right-map').css('height', hlHeight);
-        var rmHeight = window.outerHeight - $('.right-map').innerHeight() - $('.head').innerHeight();
-        var windowHeight = $('.right-map').innerHeight() - $('.head').innerHeight() + 45;
-        var spWidth = ($('.show-fifth').innerWidth() - $('.wrap_result').innerWidth())/2;
-        $('.wrap_result').css({'top': spWidth,'left': spWidth});
-        $('.title-second').css({'top':windowHeight,'left': spWidth});
-        $('.show-fifth').css('height',rmHeight);
-        $('.right-search').hide().css('top', '0px');
-        // $('.top_search').show();
-        $('.top_search').fadeIn(500);
-        $('.wrap_handle').hide()
+        let ran = navigator.userAgent
+        let isIOS = !!ran.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)
+        if (isIOS){
+            var hBHeight = (window.outerHeight - $('.head').outerHeight())/2;
+            $('.show-fifth').fadeIn(500).siblings().fadeOut(50);
+            $('.right-map').css('height', hBHeight);
+            var wsHeight = window.outerHeight - $('.right-map').innerHeight() - $('.head').innerHeight() - 11;
+            var windowHeight = window.outerHeight - $('.right-map').innerHeight() - $('.head').innerHeight();
+            var spWidth = ($('.show-fifth').innerWidth() - $('.wrap_result').innerWidth())/2;
+            $('.title-second').css({'top':windowHeight,'left': spWidth});
+            $('.show-fifth').css('height',hBHeight);
+            $('.wrap_result').css('height',wsHeight);
+            $('.right-search').hide().css('top', '0px');
+            $('.top_search').fadeIn(500);
+            $('.wrap_handle').hide();
+            $('body').css('overflow','hidden');
+        }else{
+            $('.show-fifth').fadeIn(500).siblings().fadeOut(50);
+            var rmHeight = window.outerHeight - $('.right-map').innerHeight() - $('.head').innerHeight();
+            var wsHeight = window.outerHeight - $('.right-map').innerHeight() - $('.head').innerHeight() - 11;
+            var windowHeight = $('.right-map').innerHeight() - $('.head').innerHeight() + 45;
+            var spWidth = ($('.show-fifth').innerWidth() - $('.wrap_result').innerWidth())/2;
+            // $('.wrap_result').css({'top': spWidth,'left': spWidth});
+            $('.title-second').css({'top':windowHeight,'left': spWidth});
+            $('.show-fifth').css('height',rmHeight);
+            $('.wrap_result').css('height',wsHeight);
+            $('.right-search').hide().css('top', '0px');
+            // $('.top_search').show();
+            $('.top_search').fadeIn(500);
+            $('.wrap_handle').hide();
+            $('.wrap_result1').scrollTop(0)
+        }
     }
 
     // 点击弹窗以外的区域隐藏弹窗
@@ -1972,14 +1990,6 @@ $(function () {
         $('.back_top').hide();
     });
 
-    // $('input').keyup(function(){
-    //     var reg = /\s/gi;
-    //     var val = $(this).val();
-	// 	if (reg.test(val)) {
-	// 		$(this).val($(this).val().replace(reg, ''));
-	// 	}
-    // })
-
     // 输入框失焦时,地图恢复拖动
     $('input').blur(function(){
         var rsTop = $('.right-search').css('top');
@@ -2011,48 +2021,6 @@ $(function () {
         }
     });
 
-    //获取原窗口的高度
-    // let originalHeight = document.documentElement.clientHeight || document.body.clientHeight
-    // window.onresize = function() {
-    //     //键盘弹起与隐藏都会引起窗口的高度发生变化
-    //     let resizeHeight = document.documentElement.clientHeight || document.body.clientHeight
-    //     if (resizeHeight < originalHeight) {
-    //         //当键盘弹起,在此处操作
-    //         // var rmHeight = window.outerHeight - $('.right-map').innerHeight() - $('.head').innerHeight();
-    //         // $('.show-first').css('height',rmHeight)
-    //         // $('.show-second').css('height',rmHeight)
-    //         // $('.show-third').css('height',rmHeight)
-    //         // $('.show-fourth').css('height',rmHeight)
-    //         // $('.show-fifth').css('height',rmHeight)
-    //         // $('.wrap_result').css('height',rmHeight)
-    //         // $('.wrap_result1').css('height',rmHeight)
-    //     } else {
-    //         //当键盘收起,在此处操作
-    //         var rmHeight = window.outerHeight - $('.right-map').innerHeight() - $('.head').innerHeight();
-    //         // $('.wrap_result').css('height',rmHeight)
-    //         // $('.wrap_result1').css('height',rmHeight)
-    //         $('.show-fourth').css('height',rmHeight)
-    //         $('.show-fifth').css('height',rmHeight)
-    //     }
-    // }
-
-    // $(document).on('focusin', function () {
-    //     // 软键盘弹出的事件处理
-    // });
-         
-    // $(document).on('focusout', function () {
-    //     // 软键盘收起的事件处理
-    //     var rmHeight = window.outerHeight - $('.right-map').innerHeight() - $('.head').innerHeight();
-    //     $('.wrap_result').css('height',rmHeight)
-    //     $('.wrap_result1').css('height',rmHeight)
-    //     $('.show-fourth').css('height',rmHeight)
-    //     $('.show-fifth').css('height',rmHeight)
-    // });
-
-    // const ua = window.navigator.userAgent.toLocaleLowerCase();
-    // const isIOS = /iphone|ipad|ipod/.test(ua);
-    // const isAndroid = /android/.test(ua);
-
     // 点击头部的公交和自驾时切换
     $('.search-change li').click(function(){
         var gjzjtext = $(this).text();
@@ -3037,13 +3005,12 @@ $(function () {
         if (searchInp == '' || searchInp == null) {
             layer.msg('输入的值不能为空!');
         }else{
+            var wsHeight = window.outerHeight - $('.right-map').innerHeight() - $('.head').innerHeight() - 11;
+            var rmHeight = window.outerHeight - $('.right-map').innerHeight() - $('.head').innerHeight();
+            $('.wrap_result1').css('height',wsHeight);
+            $('.show-fourth').css('height',rmHeight);
             searchJSON(searchInp);
         }
-        // var rmHeight = window.outerHeight - $('.right-map').innerHeight() - $('.head').innerHeight();
-        // $('.wrap_result').css('height',rmHeight)
-        // $('.wrap_result1').css('height',rmHeight)
-        // $('.show-fourth').css('height',rmHeight)
-        // $('.show-fifth').css('height',rmHeight)
 	});
 
     $('.inp').bind('keyup',function(event) {
@@ -3056,25 +3023,16 @@ $(function () {
 			if (searchInp == '' || searchInp == null) {
                 layer.msg('输入的值不能为空!');
 			} else {
+                var wsHeight = window.outerHeight - $('.right-map').innerHeight() - $('.head').innerHeight() - 11;
+                var rmHeight = window.outerHeight - $('.right-map').innerHeight() - $('.head').innerHeight();
+                $('.wrap_result1').css('height',wsHeight);
+                $('.show-fourth').css('height',rmHeight);
                 searchJSON(searchInp);
 			}
             document.activeElement.blur();  // 关闭软键盘
 		}
 	});
 
-    // $('input').keydown(function(e) {
-    //     if (e.keyCode == 32) {
-    //         return false;
-    //     }
-    // });
-    // $('.inp').blur(function(){
-    //     var rmHeight = window.outerHeight - $('.right-map').innerHeight() - $('.head').innerHeight();
-    //     $('.wrap_result').css('height',rmHeight)
-    //     $('.wrap_result1').css('height',rmHeight)
-    //     $('.show-fourth').css('height',rmHeight)
-    //     $('.show-fifth').css('height',rmHeight)
-    // });
-
     function searchJSON(searchInp){
         $('.show-fourth').show().siblings().hide();
         $('.right-search').hide();
@@ -3133,14 +3091,14 @@ $(function () {
             var rmHeight = window.outerHeight - $('.right-map').innerHeight() - $('.head').innerHeight();
             var windowHeight = $('.right-map').innerHeight() - $('.head').innerHeight() + 45;
             var spWidth = ($('.show-fourth').innerWidth() - $('.wrap_result1').innerWidth())/2;
-            $('.wrap_result1').css({'top': spWidth,'left': spWidth});
+            // $('.wrap_result1').css({'top': spWidth,'left': spWidth});
             $('.title-second').css({'top':windowHeight,'left': spWidth});
         } else {
             $('.show-fourth').show().siblings().hide();
             $('.right-map').css('height', hlHeight);
             var windowHeight = $('.right-map').innerHeight() - $('.head').innerHeight() + 45;
             var spWidth = ($('.show-fourth').innerWidth() - $('.wrap_result1').innerWidth())/2;
-            $('.wrap_result1').css({'top': spWidth,'left': spWidth});
+            // $('.wrap_result1').css({'top': spWidth,'left': spWidth});
             $('.title-second').css({'top':windowHeight,'left': spWidth});
             $('.right-search').hide();
             $('.top_search').show();
@@ -3176,7 +3134,7 @@ $(function () {
             $('.show-fourth').show().siblings().hide();
             var windowHeight = $('.right-map').innerHeight() - $('.head').innerHeight() + 45;
             var spWidth = ($('.show-fourth').innerWidth() - $('.wrap_result1').innerWidth())/2;
-            $('.wrap_result1').css({'top': spWidth,'left': spWidth});
+            // $('.wrap_result1').css({'top': spWidth,'left': spWidth});
             $('.title-second').css({'top':windowHeight,'left': spWidth});
             $('.right-search').hide();
             $('.right-map').show().siblings('.top_search').show();
@@ -3262,7 +3220,7 @@ $(function () {
             var rmHeight = window.outerHeight - $('.right-map').innerHeight() - $('.head').innerHeight();
             var windowHeight = $('.right-map').innerHeight() - $('.head').innerHeight() + 45;
             var spWidth = ($('.show-fourth').innerWidth() - $('.wrap_result1').innerWidth())/2;
-            $('.wrap_result1').css({'top': spWidth,'left': spWidth});
+            // $('.wrap_result1').css({'top': spWidth,'left': spWidth});
             $('.title-second').css({'top':windowHeight,'left': spWidth});
             $('.right-search').hide();
             $('.top_search').show();

+ 0 - 1
nngkxxdp/src/main/resources/static/district/sy_mobile.html

@@ -27,7 +27,6 @@
             <img src="./img/second-erw-3.png" alt="" class="first_erw">
         </a>
     </div>
-
     <div class="main">
         <div class="top_search">
             <div class="input-icon">