2012-03-11 3 views
-1

코드는 google maps api가 검색 주소를 자동 완성하는 데 사용됩니다. 내 joomla 사이트에서 충돌 때문에 그것을 변환해야합니다. 어떻게하면 Mootools 1.4에서도 같은 결과를 얻을 수 있습니까? 어떤 도움을 많이 주시면 감사하겠습니다!일부 Jquery 코드를 Mootools로 변환

$(document).ready(function() { 

    initialize(); 

    $(function() { 
    $("#entry_3").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) { 
     $("#entry_4").val(ui.item.latitude); 
     $("#entry_5").val(ui.item.longitude); 
     var location = new google.maps.LatLng(ui.item.latitude, ui.item.longitude); 
     marker.setPosition(location); 
     map.setCenter(location); 
     } 
    }); 
    }); 
}); 

편집 : 여기

코드입니다 window.onunload = GUnload 추가하는 것은 잘못이다; Google지도 api v3에서. 그것은 v2 함수입니다. v3에는 onunload가 필요하지 않습니다. 그리고 그것은 자동 완성 기능을 엉망으로 만들었습니다.

+0

는 "충돌 '아니 충돌을 사용 Mootools의에서 코드를 작성할 필요가 없습니다 이 스케일의 무언가를 시도하기 전에 jQuery.noConflict()를 사용하려고 했습니까? 충돌이 있으면 "CNTRL + F"를 사용하고 "$"의 모든 인스턴스를 "jQuery"로 바꿉니다 – Ohgodwhy

+0

시도했지만 결과. – m1r0

+0

받은 오류는 무엇입니까? jQuery.noConflict()의 사용법; 큰 문제 야. 이 문제에 대한 문서에 대한 링크가있는이 페이지에 대한 대답이 있습니다. 너가 '* 올바르게하고있다'고 확신시킨 후에도 문제가 계속되면 알려줘. – Ohgodwhy

답변