Gmap3 - Forum

Gmap3 exchange platform

You are not logged in.

Ads
(server costs 27.50€ per month)


#1 2012-08-01 19:37:46

onlyjf
Member
Registered: 2012-08-01
Posts: 2

how to open infowindow from External Link Trigger InfoWindow

Hi, All

how to open infowindow from External Link Trigger InfoWindow

like this

http://koti.mbnet.fi/ojalesa/boundsbox/ … _plain.htm

Best wishes,

Offline

Ads
(server costs 27.50€ per month)


#2 2012-10-12 13:27:19

icezAz
Member
Registered: 2012-10-12
Posts: 1

Re: how to open infowindow from External Link Trigger InfoWindow

After hours of struggle, I got this working, it also add's a filter to the results;
Image: http://imageshack.us/photo/my-images/42/gmapsl.png

    <script type="text/javascript" src="tpl/template/js/jquery/jquery-1.5.1.min.js"></script>        
    <script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
    <script type="text/javascript" src="tpl/template/js/jquery/gmap3.js"></script> 
    <style>
        body {
            font-family:'PT Sans', Arial, sans-serif;
            font-size:13px;
            margin: 0;
            padding: 0;
        }
        .gmap3{
            width: 80%;
            height: 100%;
            float: left;
        }

        #list {
            width: 20%;
            height: 100%;
            float: left;
            
        }
        #list .top {
            height: 30px;
        }
        #list .top h3 {
            margin: 10px;
            margin-bottom: 0;
            position: absolute;
            font-size: 1.6em;
        }
        #list .top #search {
            float: right;
            margin: 10px;
        }
        #list .top a {
            top: 10px;
            color: black;
        }
        #list .content {
            overflow-y: scroll;
            width: 100%;
        }
        #markers {
            border-top: 1px solid #ccc;
            padding: 0;
            margin: 0;
            width: 100%;
        }
        #markers li {
            border-bottom: 1px solid #ccc;
            list-style-type: none;
            font-size: 0.8em;
        }
        #markers li img {
            vertical-align: middle;
            margin-right: 10px;
        }
        #markers li a {
            display: block;
            padding: 8px 10px;
            background: #f9f9f9;
            text-decoration: none;
            font-weight: bold;
            color: #058dc7;
        }
        #markers li span {
            float: right;
            margin: 4px;
            color: #ccc;
        }
        #markers li a:hover {
            background: #f1f1f1;
        }
        h3 {
            margin: 0;
            padding: 0;
        }
        em {
            color: #666666;
        }
        
    </style>
    
    <script type="text/javascript">
        /* <![CDATA[ */
        $(function(){
            $.post('../app/modules/worldmap/models/feed.m.php',  function(data) {
                $('#test1').gmap3({
                    action: 'init',
                    center: [2.811371, 4.557129],
                    zoom: 20,
                    mapTypeId: google.maps.MapTypeId.TERRAIN,
                    callback : function(){
                        $.each(data, function(i, item){
                            $("#list ul").append('<li><span>' + item.type + '</span><a href="#" rel="' + i + '"><img src="'+ item.options.icon +'" />' + item.title + '</a><div style="display: none;">'+ item.data +'</div></li>');
                        });
                    }
                }, {
                    action: 'addMarkers',
                    markers: data,
                    marker: {
                         options: {
                             draggable: false,
                             animation: google.maps.Animation.DROP
                         },
                         events: {
                            click: function(marker, event, data) {
                                var map = $(this).gmap3('get'),
                                infowindow = $(this).gmap3({action:'get', name:'infowindow'});
                                if (infowindow){
                                    infowindow.close();
                                    infowindow.open(map, marker);
                                    infowindow.setContent(data);
                                } else {
                                    $(this).gmap3({action:'addinfowindow', anchor:marker, options:{content: data}});
                                }
                            },
                            mouseover: function(marker, event, data) {},
                            mouseout: function(marker, event, data) {}
                            
                        }
                    }
                });
            },'json');

            $("#list ul li a").live("click", function(){
                var tagid = $(this).attr("rel");
                var data = $(this).next("div").html();
                var map = $("#test1").gmap3('get');
                var infowindow = $("#test1").gmap3({action:'get', name:'infowindow'});
                var marker = $("#test1").gmap3({action:'get', name:'marker', tag: parseInt(tagid)});
                console.log(tagid);
                if (infowindow) {
                    infowindow.close();
                    infowindow.open(map, marker);
                    infowindow.setContent(data);
                } else {
                    $("#test1").gmap3({action:'addinfowindow', anchor:marker, options:{content: data}});
                }
                return false;
            });
        });
        
        
        
        // custom css expression for a case-insensitive contains()
        jQuery.expr[':'].Contains = function(a,i,m){
            return (a.textContent || a.innerText || "").toUpperCase().indexOf(m[3].toUpperCase())>=0;
        };

        (function ($) {
            function listFilter(header, list) { // header is any element, list is an unordered list
                // create and add the filter form to the header
                var form = $("<form>").attr({"class":"filterform","action":"#"}),
                input = $("<input>").attr({"class":"filterinput","type":"text","placeholder":"Search..."});
                $(form).append(input).appendTo(header);
                $(input).change( function () {
                    var filter = $(this).val();
                    if(filter) {
                        // this finds all links in a list that contain the input,
                        // and hide the ones not containing the input while showing the ones that do
                        $(list).find("a:not(:Contains(" + filter + "))").parent().hide();
                        $(list).find("a:Contains(" + filter + ")").parent().show();
                    } else {
                        $(list).find("li").show();
                    }
                    return false;
                })
                .keyup( function () {
                    // fire the above change event after every letter
                    $(this).change();
                });
            }

            //ondomready
            $(function () {
                listFilter($("#search"), $("#markers"));

                var list_height = $("body").height() - ( $(".top").height() + 30 );
                $(".content").height(list_height);
            });
        }(jQuery));
        
        
        
        /* ]]> */
    </script>

    <div id="test1" class="gmap3"></div>
    <div id="list">
        <div class="top">
            <span id="search"></span>
            <h3><a href="javascript:history.back(-1);" id="back">Worldmap</a></h3>
        </div>
        <div class="content">
            <ul id="markers"></ul>
        </div>
    </div>

and my simple feed:

[
{"lat":48.8620722, "lng":2.352047, "title": "Paris", "data":"<h1>Paris</h1>", "options": {"icon": "http://code.google.com/intl/fr/apis/maps/documentation/javascript/examples/images/beachflag.png"} },
{"lat":46.59433,"lng":0.342236, "title": "Poitiers", "data":"Poitiers : great city !", "options": {"icon": "http://code.google.com/intl/fr/apis/maps/documentation/javascript/examples/images/beachflag.png"} },
{"lat":42.704931, "lng":2.894697, "title": "Perpignan", "data":"Perpignan !  GO USAP !", "options": {"icon": "http://code.google.com/intl/fr/apis/maps/documentation/javascript/examples/images/beachflag.png"} }
]

Last edited by icezAz (2012-10-15 08:54:42)

Offline

#3 2012-11-13 08:11:55

ojnet
Member
Registered: 2012-11-13
Posts: 1

Re: how to open infowindow from External Link Trigger InfoWindow

@icezAz - do you have a working example somewhere?

I tried getting this working locally and failed. It is loading the json and not displaying the map.

Thanks.

Offline

#4 2012-11-21 04:40:52

inkarte
Member
Registered: 2012-11-21
Posts: 1

Re: how to open infowindow from External Link Trigger InfoWindow

Hi, Just change the height of the div for .gmap3 an amount in pixels:

  .gmap3{
        width: 80%;
        height: 700px;/*height must be in pixels*/
        float: left;
    }

got it working well but I could not make the links work , any help is appreciated

Offline

#5 2015-01-08 04:39:13

Patino
Member
Registered: 2015-01-08
Posts: 1

Re: how to open infowindow from External Link Trigger InfoWindow

This is tolerable and great post.....you shook posting it much obliged a lot......!!!







_________________________
Johni

Last edited by Patino (2015-01-08 04:39:28)

Offline

#6 2017-08-06 14:37:18

ronnykinge
Member
Registered: 2017-04-06
Posts: 3,311

Re: how to open infowindow from External Link Trigger InfoWindow

coordinator, investment Having a wellformatted resume is almost as important. Finance management (product revenue, APR, monthly fees, price and tariffs). Process Managers and end users in all SAP related matters.  english essay site  templates for stock trading Futures trading mobile app Binary option strategies in. at National Louis University (Chicago), Northern Illinois University (NIU), and. 
in the Haymarket, to help us reflect on the riot and its. Even though you may only have a few hours to write this essay, taking a few moments at the beginning to develop a.  free homework help  Full text of "A Compendium of American Literature: Chronologically. 
Did you ever think of making one more step and start appearing regularly on A.  loosely defined plan, as high level requirements get defined, refining project. Catering manager CV template, how to write a CV, beverages, hospitality.  resume formats for mechanical engineers

Offline

#7 2017-10-05 21:07:47

ronnykinge
Member
Registered: 2017-04-06
Posts: 3,311

Re: how to open infowindow from External Link Trigger InfoWindow

your name) you want to write in runes and choose the font. on the great food and wonderful, openhearted people.  IT skills by putting your CV on the Internet (with an abbreviated address), for. PLM magazine in Russian language observing (CAPP&CAM), architecture. Seattle Pacific University Admissions Requirements & Applications.  i need help with college application essay 
investigation results of the DRCCS with static RAM and its impact on the. graduatelevel research is all about, so that is covered too.  Organization Behavior Essay writing analysis review: Group Decision Making Model. 2009) has indicated that, once Where to buy good essays.  resume help for veterans 
first InstaEDU tutoring session in the subject of AP English Literature. Everything you need to know about the setting of William Shakespeare's Much.  free divorce papers online  Frederick Douglas' "Narrative of a Slave" In the Narrative of the Life of. Increasing production of an energy source long touted as greener than coal seems like a win, but fracking is a Faustian this essay (five months before. 
accountant, you first must become licensed in your state.  Custom Effective Communication Essay Writing Service Effective Communication Essay samples, help.  help writing dissertation proposal project

Offline

Board footer

Powered by FluxBB