Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working stand alone example of the Mixed / Ajax version #134

Open
thegeneralidea opened this issue Apr 23, 2016 · 1 comment
Open

Working stand alone example of the Mixed / Ajax version #134

thegeneralidea opened this issue Apr 23, 2016 · 1 comment

Comments

@thegeneralidea
Copy link

thegeneralidea commented Apr 23, 2016

Is there a working stand alone version of the mixed / ajax example, I can't seem to get the markers to display on the map? I've tried the various demos but can't seem to get any below the Markers example working
http://thegeneralidea.com/maps/maplace-markers.html - working
http://thegeneralidea.com/maps/maplace-tabs.html - not working

@danielemoraschi
Copy link
Owner

The example on the website is stand-alone (check to code tab):

Js:

var maplace = new Maplace({
    map_div: '#gmap-mixed',
    controls_div: '#controls-mixed',
    controls_type: 'list',
    controls_on_map: false
});

$('#tabs a').click(function(e) {
    e.preventDefault();
    var index = $(this).attr('data-load');
    showGroup(index);
});

function showGroup(index) {
    var el = $('#g'+index);
    $('#tabs li').removeClass('active');
    $(el).parent().addClass('active');
    $.getJSON('data/ajax.php', { type: index }, function(data) {
        //loads data into the map
        maplace.Load({
            locations: data.locations,
            view_all_text: data.title,
            type: data.type,
            force_generate_controls: true
        });
    });
}

showGroup(0);

Html:

<ul id="tabs">
    <li><a href="javascript:void(0)" data-load="0" id="g0" title="Group A">Group A</a></li>
    <li><a href="javascript:void(0)" data-load="1" id="g1" title="Group B">Group B</a></li>
    <li><a href="javascript:void(0)" data-load="2" id="g2" title="Group C">Group C</a></li>
    <li><a href="javascript:void(0)" data-load="3" id="g3" title="Group D">Group D</a></li>
    <li><a href="javascript:void(0)" data-load="4" id="g4" title="Group E">Group E</a></li>
</ul>
<div id="controls-mixed"></div>
<div id="gmap-mixed"></div>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants