• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

how to hide previous markers when new markers added in google map javascript api

javascriptphphtml


PHP Snippet 1:

const THRESHOLD = 3 // up to 3 active markers
let list = [] // list of markers

const onAddMarker = marker => {

    // init marker
    let marker = new google.maps.Marker([...opts]) 

    // push marker to list
    list.push(marker)

    // check list length and remove oldest marker (if needed)
    if (list.length > THRESHOLD)
        list.shift().setMap(null)
    
}

Related Snippets

enroll_table three field fetch to payment form to create payment field in laravel 5.5

How to install php_imagick on wamp64

GuzzleHttp Hangs When Using Localhost

Image upload not working through ajax Laravel

correct PHP headers for pdf file download

Don't show recurring price for WooCommerce subscriptions worth 0$

TesseractOCR not working for Laravel

google content api for shopping

I want to store data in new index as per my key in php [duplicate]

Batch request Google Calendar php API

Changing font color in javascript

Live search query using JS and PHP for QA forum

PHP AWS Cognito 'Error executing "SignUp" : ResourceNotFoundException : User pool client XXXX does not exist

Two buttons one form

Clear javascript source cache laravel 5.8

About Contact Privacy policy Terms and conditions