🔥 با کمک هوش مصنوعی در کمتر از 6 ماه فول‌استک شوید ...
۰ ثانیه
۰ دقیقه
۰ ساعت
۵ تیران عبدالملکی
برمیگرده تو نقشه
جامعه پی اچ پی ایجاد شده در ۰۴ مرداد ۱۴۰۲

e02e-Screenshot (49).pngلام.

وقتی میخوام لوکیشن روبگیرم یک لحظه نمایش میده و‌دوباره برمیگرده تو نقشهb39c-Screenshot (47).pngfbad-Screenshot (41).png1e7d-Screenshot (48).png

سلام امیر عزیز

بخاطر اسکریپت زیر هستش که به محض دریافت لوکیشن شما میاد و لوکیشن فعلی رو نشون میده.

میتونید از اسکریپت‌ها خارجش کنید و در صورت نبودن لوکیشن اعمالش کنید:

map.on('locationfound', function(e) {
    // if position defined, then remove the existing position marker and accuracy circle from the map
    if (current_position) {
        map.removeLayer(current_position);
        map.removeLayer(current_accuracy);
    }
    var radius = e.accuracy;
    current_position = L.marker(e.latlng).addTo(map)
        .bindPopup("دقت تقریبی: " + radius + " متر").openPopup();
    current_accuracy = L.circle(e.latlng, radius).addTo(map);
});
// index
 if($location): ?>
            L.marker([$location->lat?>, $location->lng?>]).addTo(map).bindPopup("$location->title?>").openPopup();
           else:?>
map.on('locationfound', function(e) {
    // if position defined, then remove the existing position marker and accuracy circle from the map
    if (current_position) {
        map.removeLayer(current_position);
        map.removeLayer(current_accuracy);
    }
    var radius = e.accuracy;
    current_position = L.marker(e.latlng).addTo(map)
        .bindPopup("دقت تقریبی: " + radius + " متر").openPopup();
    current_accuracy = L.circle(e.latlng, radius).addTo(map);
});  
          endif; ?>
اُوژن ملکیان ۰۵ مرداد ۱۴۰۲، ۰۷:۰۳

دقیقا متوجه نشدم‌.ممنون‌میشم واضحتر توضیح بدید

تیران عبدالملکی ۰۵ مرداد ۱۴۰۲، ۱۵:۱۱

شما بار اول که اجازه لوکیشن رو میدید بعدش خود اسکریپت بررسی میکنه که با پیدا شدن لوکیشن نقشه مکان شما رو پیدا کنه.

اُوژن ملکیان ۰۶ مرداد ۱۴۰۲، ۱۳:۴۹

فکر کنم‌منظور شما اینه‌که این‌ قسمت رو‌کامنت‌کنم.ولی بازم کار نکرد.اصلا لوکیشن فعلیه منو نمایش نمیدهbbf1-Screenshot (57).png

تیران عبدالملکی ۰۶ مرداد ۱۴۰۲، ۱۵:۰۷

پروژه رو به همراه دیتابیس در گیت قرار بدید بررسی بشه.

بهترین پاسخ
اُوژن ملکیان ۱۲ مرداد ۱۴۰۲، ۲۱:۱۴