Skip to content

Instantly share code, notes, and snippets.

@hernandezalek
Last active August 24, 2017 03:36
Show Gist options
  • Save hernandezalek/200e1aa57297c63544472557f6b762ad to your computer and use it in GitHub Desktop.
Save hernandezalek/200e1aa57297c63544472557f6b762ad to your computer and use it in GitHub Desktop.
$(document).ready(function(){
$(document).foundation();
$(document).on('change.zf.tabs', '[data-active-collapse]', function () {
window.dispatchEvent(new Event('resize'));
});
});
def index
@homes = Home.all
@hash = Gmaps4rails.build_markers(@homes) do |home, marker|
marker.lat home.latitude
marker.lng home.longitude
end
end
<div class="tabs-panel" id="geolocation">
<div id="map" style='width: 100%; height: 300px;'></div>
<script type="text/javascript">
handler = Gmaps.build('Google');
handler.buildMap({ provider: {}, internal: {id: 'map'}}, function(){
markers = handler.addMarkers(<%=raw @hash.to_json %>);
handler.map.centerOn(markers)
handler.bounds.extendWith(markers);
handler.fitMapToBounds();
handler.getMap().setZoom(16);
});
</script>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment