🚀 تخفیف ۳۵٪ + ۳.۵ میلیون هدیه! برنامه‌نویسی رو الان شروع کن - فقط امروز!
۰ ثانیه
۰ دقیقه
۰ ساعت
۵ امیر احمدی
برمیگرده تو نقشه
جامعه پی اچ پی ایجاد شده در ۰۴ مرداد ۱۴۰۲

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

امیر احمدی ۰۶ مرداد ۱۴۰۲، ۱۵:۰۷

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

بهترین پاسخ
احمدرضا فاطمی کیا ۱۲ مرداد ۱۴۰۲، ۲۱:۱۴