0

I have this code:

CSS

.flyout {
  position: absolute;
  top: 30px;
  right: 15px;
  background-color: #FFF;
  padding: 20px;
  border: 1px solid #eaeaea;
  z-index: 999;
  width: 400px;
  border-top: 3px solid #337AB7;
  display: none;
  transition-timing-function: ease-in-out 1s;
  /* Firefox v3.5+ */
  -moz-box-shadow:0px 4px 10px rgba(0,0,0,0.1);
  /* Safari v3.0+ and by Chrome v0.2+ */
  -webkit-box-shadow:0px 4px 10px rgba(0,0,0,0.1);
  /* Firefox v4.0+ , Safari v5.1+ , Chrome v10.0+, IE v10+ and by Opera v10.5+ */
  box-shadow:0px 4px 10px rgba(0,0,0,0.1);
  -ms-filter:"progid:DXImageTransform.Microsoft.dropshadow(OffX=0,OffY=4,Color=#1a000000,Positive=true)";
  filter:progid:DXImageTransform.Microsoft.dropshadow(OffX=0,OffY=4,Color=#1a000000,Positive=true);
}
@media (max-width: 768px) {
    .fav {
        position: relative;
    }
    .flyout {
        left:0;
    }
}

.flyout:before {
  border-bottom: 10px solid #337AB7;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  content: "";
  display: inline-block;
  right: 15px;
  position: absolute;
  top: -10px;
  transition: border ease-in-out .18s;
}

HTML

<li class="fav">
    <a href="#" class="tools" target="_self" title="Favoriten">
        <span class="glyphicon glyphicon-star"></span>
        <span class="hidden-sm hidden-md hidden-xs"> Meine Favoriten (3)</span>
    </a>
    <div class="flyout">
        <h4>
            Meine Favoriten
            <span class="glyphicon glyphicon-remove pull-right" 
                  aria-hidden="true" title="Schliessen"></span>
        </h4>

        <div class="flyout-item">
            <a href="#"><b>Abteilungsleiter Lüftung</b> (80%-100%)</a>
            <span class="glyphicon glyphicon-trash pull-right" 
                  aria-hidden="true" title="Entfernen"></span>
            <br>
            <span class="glyphicon glyphicon-map-marker" 
                  aria-hidden="true"></span> 
            XY
        </div>
    </div>
</li>

My goal is that up to the breakpoint 768 the flyout should be full width of the view port. So mobile should be full width.

Here is a code pen http://codepen.io/anon/pen/NdPQaQ It works with the bootstrap dropdown.

Could you please explain me, why left: 0 is not working in this case?

GôTô
  • 7,974
  • 3
  • 32
  • 43
olivier
  • 2,585
  • 6
  • 34
  • 61

1 Answers1

2

Add to specific resolution

@media (max-width: 767px)
{
    li.fav 
    {
        position: static;
    }
}
vedankita kumbhar
  • 1,468
  • 6
  • 19
  • 42
  • yes, that was it. Thank you very much. Why do I need static instead of relative positioning? – olivier Jan 06 '17 at 08:01
  • Welcome :) please go through this link http://stackoverflow.com/questions/5011211/difference-between-static-and-relative-positioning for more details. – vedankita kumbhar Jan 06 '17 at 08:39