When I click on my contact button in my navbar the map at the bottom of the page is not loading unless I refresh. When I click on the contact button this is what I get:
Notice the console errors it is giving me. I have tried both of these lines within the same link_to tag 'data-no-turbolink' => true
and :data => {no_turbolink:'true'}
The only way it works is when I refresh which gives me the correct look:
This is what my navbar code is for the contact portion <%= link_to 'Contact Us', '/contacts', class: "dropdown-toggle", data_toggle: "dropdown", :data => {no_turbolink:'true'} %>
Here is the code for my map in my contact form:
<script>
handler2 = Gmaps.build('Google');
handler2.buildMap({ provider: {}, internal: {id: 'contact_map'}}, function(){
markers = handler2.addMarkers([
{
"lat": 34.047103,
"lng": -118.434072
}
]);
handler2.bounds.extendWith(markers);
handler2.fitMapToBounds();
});
</script>
I have tried the different suggestions in similar questions asked but nothing is working for me. My goal is to have the map always load whenever I click on the link.
you may cek this link for reference disable turbolink on specific link , for your code above you can try this code below
<div data-turbolinks="false">
<%= link_to 'Contact Us', '/contacts', class: "dropdown-toggle", data_toggle: "dropdown" %>
</div>