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

Implementing automatic line breaks in Bootstrap

When setting the "overflow scroll able" option, I want it to only allow scrolling in the y direction and if x content overflows, a line break should occur. I tried applying 'white-space', but it didn't work as expected. <ul class="s ...

The inner HTML functionality in Angular 2 seems to be malfunctioning when dealing with HTML tags

I am facing an issue with an array that includes displayName with HTML tags: this.topicsList = [ {id: "173", name: "Discussion1", displayName: "Discussion1", status: 1}, {id: "174", name: "discussion123", displayName: "discussion123", status: 1}, {id: "19 ...

Hiding content in HTML with the Display:none property

After exploring various posts on this topic, I am still unable to find a solution that fits my specific scenario. Despite the challenges, I thought it would be worth asking for recommendations. Currently, I have a PowerShell script generating a report in ...

What CSS selector should I apply to create a circular profile image for Buddypress users?

In my current WordPress project, I am utilizing the BuddyPress, WooCommerce, and WC Vendors plugins for enhanced functionality. To personalize each vendor's product listings, I decided to display their BuddyPress profile picture alongside their produ ...

How to download a file using AJAX in Laravel?

Is there a way to download a CSV file within an ajax call? I have an ajax request in my Laravel controller that successfully retrieves the file contents in the response. However, I am facing issues with actually downloading the file. Laravel controller c ...

Trouble with executing AJAX for API call

My current project is built on CI3 and I have created an API that belongs to a different domain than the application itself. $.ajax({ url: "http://www.example.com/restapi/index.php/api/user", type: "GET", data: {"user_id": user_id} ...

I encountered an error from DataTables when trying to set the width of the header cells using the original width of the columns

                 Help! I keep getting an error message: DataTable Uncaught TypeError: Cannot read property 'style' of undefined Does anyone have any ideas on how to fix this?   I keep seeing the following error message: Uncaught Typ ...

Interactive chat feature with live updates utilizing jQuery's $.Ajax feature for desktop users

I came across a script for real-time chat using $.ajax jQuery, but it only refreshes my messages. Here's an example scenario: I type: Hello to You, and I see this message refreshed. You reply: Hey, in order to see your message, I have to manually refr ...

The form submits automatically upon loading the page with empty input fields

I recently created a form on my website located at . Initially, the form functioned correctly and the PHP script executed as expected. However, I am now encountering an issue where every time I load the page, a popup message appears indicating that the for ...

Adjust the input dimensions to match the length of the text upon loading

I have a jQuery code that is supposed to test the length of text in an input box when the page loads and adjust the size of the input box accordingly. However, I seem to be encountering some issues with my current approach: $("#emailSubject").attr('s ...

Setting up jsonReader for jqGrid Configuration

I am having trouble displaying data in my Jqgrid. The Json data is coming from a web server, so I am attempting to format it using Jsonreader as a function. Could someone please help me identify any mistakes? Thank you in advance. Here is the code for the ...

Turn off HTML5 Audio

There are 4 <audio> elements on a webpage. The client has asked for them to be available sequentially. Meaning, the first audio should play, then the rest should remain disabled until the first one finishes, and so on. In addition, they want the au ...

Duplicate an HTML document while excluding specific class div elements

If you want to duplicate your HTML file using jQuery, it can be done like this: alert($("html").clone().html()); My objective is to replicate the entire program while excluding divs with the class '.ignore', but so far I am only able to display ...

What is the mechanism through which a flexbox enlarges to accommodate its overflowing child elements?

I am working with a flexbox layout. Here is the HTML code structure: <div class="grid"> <div class="row"> <div class="column">Content</div> <div class="column">Content2</div> <div class="column">Con ...

Place the divs over the background image by using relative positioning

I am working on a project where I have a full-width div with a background image containing people. I want to display a tooltip when hovering over each person, but I am facing challenges in aligning the divs properly. Image maps with % widths do not seem t ...

python conducting automation tests with Selenium WebDriver on a mouse

Hello, I'm having trouble with opening the Mouser website and using the search bar to send some data. Below is a sample of the code I've been working on, but I can't seem to find the correct CSS selector. Any help would be greatly appreciate ...

"Interactive functionality: Toggling checkboxes with a DIV click

I am trying to set up a simple div container that displays contact information in a formatted list (<ul><li>). Clicking on the div currently takes you to the user's profile page, which is functioning correctly. However, I am facing an iss ...

JavaScript form validation: returning focus to textfields

I am currently working on a project where I am using JQuery and JavaScript to create an input form for time values. However, I am facing challenges in getting the JavaScript code to react correctly when incorrect input formats are detected. I have a group ...

Utilizing Javascript and CSS for horizontal alignment from left to right

I have a JavaScript function that generates a list of store locations and creates a DIV beneath the map. Currently, the items are displayed top to bottom on the page. However, I would like to change the layout so that the items are shown as 3 in a row fro ...

AngularJS - How to Deactivate List Items

Currently, I am working on developing a breadcrumb navigation system using AngularJS. However, I am facing an issue where some of the links need to be disabled based on certain user requirements not being met. After researching the Angular documentation, ...