How to fixed a element in Bootstrap?

H Vn Lc BIT

I create two columns with col-md-8 and col-md-4 with col-md-4 contains my maps.

But I have a problem when I tried fixed map to col-md-4.

function init_map() {
var var_location = new google.maps.LatLng(45.430817, 12.331516);

var var_mapoptions = {
    center: var_location,
    zoom: 14
};

var var_marker = new google.maps.Marker({
    position: var_location,
    map: var_map,
    title: "Venice"
});

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);
.contact {
  position: absolute;
  color: rgb(255, 255, 255);
  background-color: rgb(0, 0, 0);
  top: 800px;
  padding: 0 0px 0 0px;
  margin: 0;
  left: 0%;
}

#map-container { height: 50px }

.service-container {
    background: url('http://images.indianexpress.com/2016/05/love-autumn-tree_759_thinkstockphotos-177812216.jpg');
    height:1000px;
    width: 1000px;
}

.layer {
    background-color: rgba(0, 179, 0, 0.6);
    width: 100%;
    height: 100%;
}
<div class="service-container">
   <div class="layer">
      <div class="contact-maps">
         <div class="col-md-8 contact">
            <div class="col-md-6">
               <div class="col-md-6"></div>
               <div class="col-md-6">
                  <h1>CONTACT</h1>
                  <h3>CENTRAL OFFICE</h3>
                  <p>
                     Lorem ipsum dolor sit amet, consectetur adipisicing elit. Recusandae laborum cum consequuntur assumenda itaque error dolore, molestiae illo fugiat. Illo praesentium ut mollitia dolorem quis vero quisquam culpa, voluptas eos.
                  </p>
               </div>
            </div>
            <!-- /.col-md-6 -->
            <div class="col-md-6">
            </div>
         </div>
         <!-- /.col-md-8 contact -->
         <div class="col-md-4">
            <div id="map-container"></div>
         </div>
         <!-- /.col-md-4 -->
      </div>
      <!-- /contact-maps -->
   </div>
   <!-- / .layer -->
</div>
<!-- service-container -->

I have two question:

  1. Why I was set <div id="map-container"> into col-md-4 but it not show?

  2. My website must responsive, but I must change at top: 800px create blank to another element before this element can appear.

I want it to show like this:

http://i.imgur.com/rM95p0q.png

matthiasunt

Regarding your first question: First of all, you have to use the Bootstrap grid system properly. BS columns must always be nested in rows (BS grid tutorial).

This would be the Bootstrap conform structure for your case:

<div class="container">
  <div class="row">
    <div class="col-md-8 contact">
      <div class="row">
        <div class="col-md-6">
          <div class="row">
            <div class="col-md-6"></div>
            <div class="col-md-6">
            </div>
          </div>
        </div>
        <div class="col-md-6">
        </div>
      </div>
    </div>
    <div class="col-md-4">
      <div id="map-container"></div>
    </div>
  </div>
</div>

Your map doesen't shows up, because you haven't loaded the Google Maps JavaScript API.

Do that with the following code:

 <script async defer
      src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap">
 </script>

You have to request an API key if you haven't so far.

PS: You should ask only one question per question.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

How make a fixed content scrollable in Bootstrap

From Dev

How to horizontally center a fixed positioned element

From Dev

How to make fixed position row in bootstrap?

From Dev

How to vertically center a dynamic height fixed element?

From Dev

How to position a html element under a fixed div

From Dev

How to make Bootstrap Panel body with fixed height

From Dev

How to find out if an element is in a fixed positioned container?

From Dev

bootstrap how to make a fixed height responsive?

From Dev

How make a fixed element be on top of another position fixed element

From Dev

How to animate a position of a fixed element with jQuery

From Dev

how to prevent scrolling through fixed element

From Dev

How do I automatically center a fixed element?

From Dev

How to make panel-heading fixed with Bootstrap?

From Dev

bootstrap scrollable dropdown menu with fixed last element after separator

From Dev

How to get "original" offset().top of a fixed element?

From Dev

How to show fixed element in center bottom

From Dev

How to Stop Jumping Position fixed element on scrolling

From Dev

How to have fixed position of element but relative to container

From Dev

How to Stop Jumping Position fixed element on scrolling

From Dev

How fixed position of element after applying animation

From Dev

How to horizontally center a fixed positioned element

From Dev

How to vertically center a dynamic height fixed element?

From Dev

How to make a div element fixed?

From Dev

how to create a fixed footer with HTML on bootstrap

From Dev

Fixed element in Bootstrap Modal doesn't scroll

From Dev

How to center a fixed top Navbar in bootstrap 4

From Dev

How to position a relative element after a fixed element

From Dev

Bootstrap: Element with position fixed inside modal not aligned with respect to the viewport

From Dev

How to fixed element in react native

Related Related

  1. 1

    How make a fixed content scrollable in Bootstrap

  2. 2

    How to horizontally center a fixed positioned element

  3. 3

    How to make fixed position row in bootstrap?

  4. 4

    How to vertically center a dynamic height fixed element?

  5. 5

    How to position a html element under a fixed div

  6. 6

    How to make Bootstrap Panel body with fixed height

  7. 7

    How to find out if an element is in a fixed positioned container?

  8. 8

    bootstrap how to make a fixed height responsive?

  9. 9

    How make a fixed element be on top of another position fixed element

  10. 10

    How to animate a position of a fixed element with jQuery

  11. 11

    how to prevent scrolling through fixed element

  12. 12

    How do I automatically center a fixed element?

  13. 13

    How to make panel-heading fixed with Bootstrap?

  14. 14

    bootstrap scrollable dropdown menu with fixed last element after separator

  15. 15

    How to get "original" offset().top of a fixed element?

  16. 16

    How to show fixed element in center bottom

  17. 17

    How to Stop Jumping Position fixed element on scrolling

  18. 18

    How to have fixed position of element but relative to container

  19. 19

    How to Stop Jumping Position fixed element on scrolling

  20. 20

    How fixed position of element after applying animation

  21. 21

    How to horizontally center a fixed positioned element

  22. 22

    How to vertically center a dynamic height fixed element?

  23. 23

    How to make a div element fixed?

  24. 24

    how to create a fixed footer with HTML on bootstrap

  25. 25

    Fixed element in Bootstrap Modal doesn't scroll

  26. 26

    How to center a fixed top Navbar in bootstrap 4

  27. 27

    How to position a relative element after a fixed element

  28. 28

    Bootstrap: Element with position fixed inside modal not aligned with respect to the viewport

  29. 29

    How to fixed element in react native

HotTag

Archive