Coder Social home page Coder Social logo

Comments (5)

kossa avatar kossa commented on September 15, 2024 1

Very helpful

a small gift : vuejs/awesome-vue#3568

from x5-gmaps.

xon52 avatar xon52 commented on September 15, 2024

Thanks 😊
Good question. I don't have a specific example of this, but if you go to the example page it would be either "Markers with Options" or a combination of "Markers with Options" and "DOM Elements / Popup":

  1. The simplest (and maybe best) is to detect the click and open a modal over the map. The cost is something pops up over the map and not where you clicked. The advantage is you can have much more space to show information (which is good if you have a lot), and it's always in the same position, so the user is never lost.

  2. The other option is when a marker is clicked, you create a "Popup" <gmaps-popup> at that location and you can put anything you want in there. The first issue is that if the popup is too big it doesn't look good. The other issue is if someone clicks on a marker near the edge of the map, you will need to do something different because the popup may not be completely visible.

If you have another idea you'd like to share, or a specific question about this, I'm happy to try and help.

from x5-gmaps.

kossa avatar kossa commented on September 15, 2024

Finally I did it here is the code may be will help someone

<template>
    <div style="height: 70vh">
        <gmaps-map :options="mapOptions">
            <gmaps-info-window v-for="marker in markers" :key="marker.id" :options="marker">
                <div class="text-center">
                    <img :src="marker.user.avatar" alt="" width="48" class="img-thumbnail rounded-circle">
                    <p class="m-0">{{ marker.user.name }}</p>
                    <a :href="marker.user.public_path">See profile</a>
                </div>
            </gmaps-info-window>
        </gmaps-map>
    </div>
</template>

image

from x5-gmaps.

xon52 avatar xon52 commented on September 15, 2024

@kossa just note that the InfoWindow is actually a Google Maps component in a Vue wrapper. The issue with the InfoWindow is that close button. The only way to hide it is with a CSS hack which is pretty messy, so that's why I made the <gmaps-popup> component (which doesn't have the close button).

Yours looks good, and if you're happy, so am I; but if you want to remove the close button, use <gmaps-popup> instead 😉

from x5-gmaps.

kossa avatar kossa commented on September 15, 2024

from x5-gmaps.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.