mdbootstrap4-pro
Version:
MDBootstrap 4 PRO
139 lines (86 loc) • 6.97 kB
HTML
<!--Section: Tutorial content-->
<section>
<p class="h5">Step 1</p>
<p>Let's start from Google Map. <strong>To make it works we have to do 3 things.</strong></p>
<p>Firstly link Google Maps script to our project.</p>
<p>Just before closing <code></body></code> tag and below <code>MDB Script</code> place <code>Google Maps script</code></p>
<pre class="code-toolbar"><code class="language-markup">
<!-- MDB core JavaScript --> <script type="text/javascript" src="js/mdb.min.js"></script> <!--Google Maps--> <script src="https://maps.google.com/maps/api/js"></script> </body>
</code></pre>
<p class="h5 mt-4">Step 2</p>
<p>Now we have to add a small piece of javascript code to set a localization and settings for our map.</p>
<p><strong>Below linked Google Maps library place a snippet with Google Maps settings.</strong></p>
<pre class="code-toolbar"><code class="language-javascript">
<!--Google Maps-->
<script src="https://maps.google.com/maps/api/js"></script>
<!--Google Maps Settings-->
<script>
function init_map() {
var var_location = new google.maps.LatLng(40.725118, -73.997699);
var var_mapoptions = {
center: var_location,
zoom: 14
};
var var_marker = new google.maps.Marker({
position: var_location,
map: var_map,
title: "New York"
});
var var_map = new google.maps.Map(document.getElementById("map-container"),
var_mapoptions);
var_marker.setMap(var_map);
}
google.maps.event.addDomListener(window, 'load', init_map);
</script>
</code></pre>
<p><strong>To set a localization:</strong></p>
<p><strong>I.</strong> Go to <a href="https://www.google.pl/maps">Google Maps</a></p>
<p><strong>II.</strong> Right click on the place where you want to set as a default place for our map</p>
<p><strong>III.</strong> Select "what's here?"</p>
<p><strong>IV.</strong> Copy the coordinates at the bottom of the card</p>
<p><strong>V.</strong> Paste it into our script into the localization variable</p>
<pre class="code-toolbar"><code class="language-javascript">var var_location = new google.maps.LatLng(40.725118, -73.997699);</code></pre>
<p>To set an appropriate zoom change the zoom's number:</p>
<pre class="code-toolbar"><code class="language-javascript">zoom: 14</code></pre>
<p class="h5 mt-4">Step 3</p>
<p>Place the map's container inside the first column of our Contact section.</p>
<pre class="code-toolbar"><code class="language-markup">
<!--First column--> <div class="col-md-8"> <!--Map container--> <div id="map-container" class="z-depth-1" style="height: 300px"></div> </div> <!--/First column-->
</code></pre>
<p><code>#map-container</code> displays the map and our map's settings.</p>
<p>You can manipulate the height of the map by changing the height value: <code>style="height: 300px"</code></p>
<p>Class<code>.z-depth-1</code> is optional and just gives map's container a nice shadow</p>
<br>
<p>Save the file and refresh your browser. You will see our map is ready.</p>
<br>
<p>Now we can add a few additional contact information to make our website more trustworthy.</p>
<p><strong>In the second column of the Contact Section place a following code:</strong></p>
<pre class="code-toolbar"><code class="language-markup">
<!--Second column--> <div class="col-md-4"> <ul> <li><i class="fa fa-map-marker"></i> <p>New York, NY 10012, USA</p> </li> <li><i class="fa fa-phone"></i> <p>+ 01 234 567 89</p> </li> <li><i class="fa fa-envelope"></i> <p>contact@mdbootstrap.com</p> </li> </ul> </div> <!--/Second column-->
</code></pre>
<p>After saving and refreshing the browser you will notice new icons in the Contact Section. But there are few things to
fix.</p>
<p class="h5 mt-4">Step 4</p>
<p>We don't need bullets in our unordered list (<code><ul></code>)</p>
<p>Add class <code>.list-unstyled</code> to <code><ul></code> to remove them.</p>
<pre class="code-toolbar"><code class="language-markup">
<ul class="list-unstyled">
</code></pre>
<p class="h5 mt-4">Step 5</p>
<p>If you want you change icons you can use one of over 600 available icons.</p>
<p>Go to <a href="https://mdbootstrap.com/css/icons-list/">ICONS DOCUMENTATION</a> and grab the icon you like. Then replace
the code within our project.</p>
<p class="h5 mt-4">Step 6</p>
<p>We should to make our icons a little bit bigger. To do it
<stron>add class <code>.fa-2x</code> to each icon.</stron>
</p>
<p>To learn more about manipulating icons' size read <a href="https://mdbootstrap.com/css/icons/">ICONS USAGE DOCUMENTATION</a>.</p>
<p>We'll also use bootstrap spacing utilities to add a proper margins to each icon and each <code><li></code> element.
</p>
<p>After all your <strong>Unordered List</strong> should look like this:</p>
<pre class="code-toolbar"><code class="language-markup">
<ul class="list-unstyled"> <li class="mb-4"><i class="fa fa-2x mb-3 fa-map-marker"></i> <p>New York, NY 10012, USA</p> </li> <li class="mb-4"><i class="fa fa-2x mb-3 fa-phone"></i> <p>+ 01 234 567 89</p> </li> <li class="mb-4"><i class="fa fa-2x mb-3 fa-envelope"></i> <p>contact@mdbootstrap.com</p> </li> </ul>
</code></pre>
<p>Save the file and refresh the browser. Our Contact Section is ready.</p>
</section>
<!--Section: Tutorial content-->