javascript - Mapbox Map not showing up with Rails -


i trying add map 1 of rails pages using mapbox. followed documentation stated on mapbox.js page, page fails show on page.

here's map.

this code on index.html.erb page:

<div class="properties-results"> <h1>recent sales near <%= params[:search] %></h1>  <div id='map'></div> <script> l.mapbox.accesstoken = 'pk.eyj1ijoibw9yywxlczi1nyisimeioijjawpybxdsmwmwy2tndg9tnxb5ajfhbje3in0.whdnbzvqn5wq5bwvtw2fbw'; l.mapbox.map('map', 'morales257.opbj9hf9').setview([-79.392524,43.654967], 5);  </script> <ul>   <% @comps.each |comparable|%>   <li><%= comparable.street %></li>   <i> <%= comparable.sold_price%></i>   <% end %> </ul>    </div> 

and header in application.html.erb page:

<head>   <title>workspace</title>  <script src='https://api.tiles.mapbox.com/mapbox.js/v2.2.4/mapbox.js'></script> <link href='https://api.tiles.mapbox.com/mapbox.js/v2.2.4/mapbox.css' rel='stylesheet' />   <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true %>   <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>   <%= csrf_meta_tags %> </head> 

from understanding should enough @ least show map on page, nothing coming up.

if familiar mapbox , rails, appreciated!

unfamiliar rails far can see, code looks fine. thing that's missing css rules map's containing element can account map not being visible without throwing errors console:

<style>     body {         margin: 0;         padding: 0;     }     #map {         position: absolute;         top: 0;         bottom: 0;         width: 100%;     } </style> 

see basic example on mapbox site: https://www.mapbox.com/mapbox.js/example/v1.0.0/


Comments