zoukankan      html  css  js  c++  java
  • plus maps实时定位

    .mapContent {
                    position: absolute;
                    top: 44px;
                    left: 0;
                    right: 0;
                    bottom: 0;
                }
     <div id="content" class="mapContent"></div>
    mui.plusReady(function() {
                var count = 0;
                var marker;
                var map = new plus.maps.Map("content");
                setTimeout(function() {
                    userlocation();
                }, 1);
                
                function userlocation() {
                //    alert("18")
                map.getUserLocation(function(state, pos) {
                    count++;
                    if(0 == state) {
    
                        if(count == 1) {
    
                            setTimeout(function() {
    
                                map.setZoom(17);
                                map.removeOverlay(marker);
                                marker = new plus.maps.Marker(pos);
                                marker.setIcon("img/icon_location@2x.png");
                                map.addOverlay(marker);
                            }, 400);
                            map.setCenter(pos);
                            setTimeout(function(e) {
    
                                userlocation();
                            }, 200);
                        } else {
    
                            map.removeOverlay(marker);
                            //                            map.setCenter(pos);
                            marker = new plus.maps.Marker(pos);
                            marker.setIcon("img/icon_location@2x.png");
                            map.addOverlay(marker);
    
                            setTimeout(function(e) {
                                //    alert("18-1-2-1")
                                userlocation();
                            }, 5000);
    
                        }
                    } else {
                        //alert("18-2")
                        alert("xxx");
                    }
                });
            }
            });
  • 相关阅读:
    Spring 事务管理
    016 sleep,wait,yield,join区别
    013 GC机制
    011 CountDownLatch,CyclicBarrier和Semaphore
    012 public等关键字可见性
    010 JVM类加载
    009 JVM内存结构以及GC机制
    008 BlockingQueue理解
    python3 正则表达式
    python django
  • 原文地址:https://www.cnblogs.com/ccllj/p/9638016.html
Copyright © 2011-2022 走看看