Drag a dropdown menu to the bottom left corner and set it to full width on mobile using CSS

Check out this code snippet with CSS and HTML:

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>

I am trying to make the flyout full width up to a breakpoint of 768 pixels for mobile devices. Here is a CodePen link that demonstrates it working with a Bootstrap dropdown menu.

Can you help me understand why the 'left: 0' property is not working in this case?

Answer №1

Include in certain screen size breakpoints

@media (max-width: 767px)
{
    li.fav 
    {
        position: static;
    }
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Having Trouble with jQuery toggleClass

I'm currently working on a project where I have implemented a button that displays a menu when clicked. I am attempting to change the color of the button when it is active, however, the toggleClass function is not behaving as expected. Below is the co ...

Searching Text Files Using PHP Based on User Input

I am in search of a way to check through a list of Zip Codes that we serve. We possess a text file filled with zip codes for the areas we cover. I would like to include a form on our website where users can input their zip code to determine if we provide s ...

Ways to access data-style in a jQuery method

I need help implementing jQuery to toggle the display of certain divs on my webpage: HTML Elements: <div class="image" data-style="bw"><img src="img/bw1.jpg"></div> <div class="image" data-style="fauna"><img src="img/fauna1.jpg ...

Ways to dynamically adjust the color of the text font?

Below is the XML content: span style="background-color: rgb(255, 255, 0); The background color mentioned here is linked to my Java code. Since this color changes dynamically, it varies in each report. My inquiry is about how to incorporate this color in ...

What is the best way to eliminate the gap between spans in Bootstrap?

Imagine you have the following code: <div class="row-fluid"> <div class="span6"></div><!--span6 END--> <div class="span6"></div><!--span6 END--> </div><!--row END--> Now envision two red b ...

Tips for displaying backend error messages on the frontend

I am facing an issue with returning error messages from the backend to the frontend in my Angular project. The specific requirement is to display an error message when the value of msisdn is not eligible for renewal. Currently, the hardcoded error message ...

An existing INPUT value can be modified by dynamically adding or subtracting values from SELECT OPTION

I currently have an <input readonly> field that displays the total_price value retrieved from a shopping cart stored in the database table. Moreover, I have included a <select> element with different transport options that can either increase o ...

Is it possible to simultaneously run multiple functions with event listeners on a canvas?

I'm attempting to create a canvas function that displays the real-time mouse cursor location within the canvas and, upon clicking, should draw a circle. I came across this code snippet that reveals the x and y coordinates of the mouse: document.addEve ...

Await the reply from Angular while using Selenium WebDriver

I am currently automating an Angular-based application using Selenium WebDriver (Java). After selecting an option from a dropdown in the Application Under Test (AUT), data is loaded onto the page through an AJAX call to a web service. However, there is no ...

Having trouble with JQuery's .prop function not unchecking a checkbox?

I have been experimenting with different solutions in order to uncheck a checkbox when another checkbox is checked. Unfortunately, none of the methods I've tried seem to be working effectively... Currently, my code looks like this: $("#chkBox1").cli ...

Firefoxx effortlessly glides divs across the screen as if they were images

Below is the HTML, CSS, and JavaScript code all in one document for testing: <style type="text/css"> #slider_container { width: 200px; height: 30px; background-color: red; display:block; } #slider { width: 20px; height: 30px ...

Having trouble getting the CSS URL to work when using a leading slash?

I am attempting to utilize a background-image with a "root-relative" path like this: background-image: url("/img/bg.jpg");. In Chrome, the property is showing correctly but the image does not appear. When I change it to http://localhost:8080/img/bg.jpg, t ...

Creating an attention-grabbing alert bar positioned above the menu

When I attempted to add this alert bar to my website, I encountered an issue where it was being hidden behind my menu. Some sources suggest that using z-index and position:absolute can resolve this problem by positioning one element above the other, but th ...

Gradually making my way to the top of the page as I reach the end of scrolling

After some trial and error, I managed to scroll to the top of my page with this jQuery script: $("html, body").animate({ scrollTop: 0 }, "slow"); However, I am aiming for a smoother scrolling experience where the speed decreases towards the end of the pr ...

There is no data in the $_POST array

Currently, I am developing a simple application running locally with XAMPP and PHPStorm v9. The issue I am facing is that the server handler for my AJAX request is returning an empty $_POST array. This problem has left me puzzled, and I cannot figure out w ...

Step-by-step guide: Building a progress bar with PHP output buffering and jQuery

Can anyone guide me on creating a progress bar using PHP output buffering and jQuery? I have been searching for weeks and I am eager to learn this. It would be a great help for me if someone could share some code snippets. I understand that scripting wil ...

I can only use innerHTML once in my React application

I am attempting to clear my container div when the user clicks the search button in order to remove all existing search results. However, I am encountering an issue where using innerHTML to clear the container div only works the first time. If a second sea ...

conceal a division beneath a YouTube video frame upon clicking

I need to hide the 'div .blind' element when a YouTube video (inside 'div #player') is clicked. How can I achieve this? Here's an example: JS: ... var player; function onYouTubeIframeAPIReady() { player = new YT.Player('pl ...

AngularJS - Custom directive to extract a property value from an object

Currently, I am using the following for loop to retrieve the parent category: angular.forEach(queryTicketCategories, function(category) { if(category.id === $scope.ticketCategory.parentId) { $scope.parent = category; } }); I am looking fo ...

React Images: Carousel display issue with images not centered

Is there a way to center the selected image instead of it appearing on the left-hand side? Here is the current behavior: https://i.stack.imgur.com/SUWOK.jpg I am using the following packages in a sandbox environment with Next.js 11 and TailwindCSS 2.2.4: ...