0

这个bug好诡异...

我的网站是https://www.merchantsbar.com/index.php 如果您单击页面底部的“联系”,或左侧的“注册”,则会弹出一个 jquery ui 对话框 shd。它适用于我测试过的所有浏览器,除了 ipad。动画后对话框隐藏。如果你有 ipad,请去测试一下。

我追查了这个问题并意识到它的谷歌地图导致了这个问题。一旦函数被触发,对话框就会丢失(请记住,到目前为止,ipad 是唯一给我带来问题的,即使 iphone 也可以!)。

提前致谢!

function initialize(canvas, AC, field_Lat, field_Lng, readonly, search_area){ 
    var Lat = Number($("#"+field_Lat).val()) == NaN ? $("#"+field_Lat).val() : 40.7399709 ;
    var Lng = Number($("#"+field_Lng).val()) == NaN ? $("#"+field_Lng).val() : -73.6135758 ;

    var latlng = new google.maps.LatLng(Lat, Lng); // LatLng
    var options = {
        zoom: 11,
        center: latlng,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };

    map = new google.maps.Map(document.getElementById(canvas), options); // MAP
    geocoder = new google.maps.Geocoder(); //GEOCODER

    if (readonly==true){ marker = new google.maps.Marker({ map: map }); } // readonly 
    else{ 
        if (search_area==true){ var distanceWidget = new DistanceWidget(map); } // SEARCH_AREA
        else{ marker = new google.maps.Marker({ map: map, draggable: true }); } // non-search_area
        autocomplete(AC, field_Lat, field_Lng); 
        geocodeReverse(AC, field_Lat, field_Lng); 
    } 
    marker.setPosition(latlng);
}

function autocomplete(AC, field_Lat, field_Lng){    
    $("#"+AC).autocomplete({
        //This bit uses the geocoder to fetch address values
        source: function(request, response){
            geocoder.geocode( {'address': request.term }, function(results, status){
                response($.map(results, function(item){
                    return {
                        label:  item.formatted_address,
                        value: item.formatted_address,
                        latitude: item.geometry.location.lat(),
                        longitude: item.geometry.location.lng()
                    }
                }));
            })
        },
        //This bit is executed upon selection of an address
        select: function(event, ui){
            $("#"+field_Lat).val(ui.item.latitude);
            $("#"+field_Lng).val(ui.item.longitude);
            var location = new google.maps.LatLng(ui.item.latitude, ui.item.longitude);
            marker.setPosition(location);
            map.setCenter(location);
        }
    });         
}

function geocodeReverse(AC, field_Lat, field_Lng){ 
    google.maps.event.addListener(marker, 'dragend', function(){
        geocoder.geocode({'latLng' : marker.getPosition()}, function(results, status){
            if (status == google.maps.GeocoderStatus.OK){
                if (results[0]){
                    $('#'+field_Lat).val(marker.getPosition().lat());
                    $('#'+field_Lng).val(marker.getPosition().lng());
                    $('#'+AC).val(results[0].formatted_address);
                    $("#Se_latitude, #Se_longitude").focus(); // inter-linked to validateField();
                    $("#"+field_Lat+", #"+field_Lng+", #"+AC).blur();
                }
            }
        });
    });
}

... 之后 ...

$(".dialog").each(function(){
    var this_ID = this.id;
    $(this).dialog({
        autoOpen: false,
        modal: true,
        width: "auto",
        show: {
            effect: "slide",
            duration: 400
        },
        hide: {
            effect: "slide",
            duration: 400
        }, 
        open: function(){ $('.ui-widget-overlay').on('click', function(){ $("#"+this_ID).dialog('close'); }); }
    });
});
4

1 回答 1

0

使用 css3 强制 3d 加速...

.ui-dialog * {
    -webkit-transform: translate3d(0, 0, 0);
}
于 2013-05-13T14:25:10.643 回答