나는 프로젝트가 있고 미친 나를 몰아, 나는 geolocation/방향을 할 코드가 있고 everthing하지만 놀라운 일을 ios7와 나는 연구의 힙을 완료하고 그 이해 .click 이벤트 문제, 내 코드는 아래 있습니다.jQuery iPhone/ios7 클릭 이벤트 대 touch
$(document).ready(function() {
var startingLocation;
var destination = "20 Papanui Rd, Christchurch Central, Christchurch 8011, New Zealand"; // replace this with any destination
$('.get-directions').click(function (e) {
e.preventDefault();
// check if browser supports geolocation
if (navigator.geolocation) {
// get user's current position
navigator.geolocation.getCurrentPosition(function (position) {
// get latitude and longitude
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
startingLocation = latitude + "," + longitude;
// send starting location and destination to goToGoogleMaps function
goToGoogleMaps(startingLocation, destination);
});
}
// fallback for browsers without geolocation
else {
// get manually entered postcode
startingLocation = $('.manual-location').val();
// if user has entered a starting location, send starting location and destination to goToGoogleMaps function
if (startingLocation != '') {
goToGoogleMaps(startingLocation, destination);
}
// else fade in the manual postcode field
else {
$('.no-geolocation').fadeIn();
}
}
// go to Google Maps function - takes a starting location and destination and sends the query to Google Maps
function goToGoogleMaps(startingLocation, destination) {
window.location = "https://maps.google.com/maps?saddr=" + startingLocation + "&daddr=" + destination;
}
});
});
HTML은 :
<!--#container -->
<div id="mapcontainer">
<div class="no-geolocation">
<p class="warning">Your browser does not support Geolocation. Please enter your postcode and click the button again.</p>
<input type="text" placeholder="Enter postcode or address" class="manual-location">
</div>
<a href="#" class="get-directions">Give me directions</a>
</div>
<!-- /#container -->
는 지금은 감동과 연극을했다.
<script type='text/javascript' src="files/scripts/touche.min.js"></script>
<script>
$(document).ready(function() {
$('.get-directions').on('click', handleClicks);
});
</script>
그리고 내가 가진 모든 오류
handleClicks is not defined
과 행운 다른 해키 스크립트의 몇이었고, 나는이 문제를 해결하기 위해 기술 능력의 나의 끝입니다. 할 정말 제대로 작동
이 기능을 확인하십시오 :
안녕하세요! 'handleClicks' 함수가'touche.min.js'에 정의되어 있다고 가정합니다. JS 스크립트가 올바르게로드 되었습니까? – Littm
답장을 보내 주셔서 감사합니다. 사이트에서 jquery-1.11.0.min.js를 사용하고 있습니다.이 슬라이더는 이미지 슬라이더로 잘 작동하므로 이미지가 잘 보이고 작동하는 것으로 알고 있습니다. – webmonkey237
다른 스크립트와 충돌 할 수 있습니까? – webmonkey237