Mobile-friendly FlexImages grid with justified image sizes

Currently utilizing the FlexImages jQuery plugin for a Justified grid, which is performing well. The only issue I am encountering is the desire for the images to span 100% width on mobile devices (viewport of 550px or less).

If interested in checking out the jQuery FlexImage plugin, you can view it here:

Below is the code snippet:

<div style="max-width:908px;margin:auto;padding:0 10px 10px">
    <div id="demo1" class="flex-images">
        <div class="item" data-w="219" data-h="180"><img src="http://placehold.it/219x180.jpg"></div>
        <div class="item" data-w="279" data-h="180"><img src="http://placehold.it/279x180.jpg"></div>
        ...
    </div>
</div>

For JavaScript functionality, use the following code:

$('#demo1').flexImages({rowHeight: 160}); 

A JSFiddle has been created for demonstration purposes at this link:

https://jsfiddle.net/1kgs3soc/

Despite attempting various CSS modifications, no success was achieved. The following code snippet was added but yielded no results:

@media (max-width:550px) {
.flex-images > div.item {
    display: block;
    width: 100%;
}
}

If anyone has insights on how to resolve this issue and make the images display as desired on mobile screens, please provide guidance.

Best regards,

Answer №1

@media only screen and (max-width: 550px) {
  .flex-images .item {
    width: 100% !important;
  }
  .flex-images .item img {
    width: 100%;
  }

}

Consider utilizing this specific media query for optimal responsiveness.

Answer №2

Experiment with a code snippet like the following:

@media (max-width:550px) {
.flex-images > div.item {
    display: block;
    width: 100% !important;
}
.flex-images > div.item img {
    width: 100%;
}
}

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

When it comes to deploying middleware, accessing cookies becomes more challenging. However, in a local setup, Next.js allows middleware to

I have set up a NextJS frontend application with a backend powered by NodeJS and ExpressJS. Authentication and authorization are handled using JWT token-based system, where the backend server sets the token and the frontend server validates it to grant acc ...

Instructions for connecting a camera to a bone or vertices on a model in A-Frame without influencing its rotation

How can I attach a first-person camera to the head of an animated GTLF model? My plan is to eliminate the model's head and combine the neck into one vertex to avoid obstructing the camera. I am curious about the process of attaching my camera to the v ...

Determine the selected item from a dropdown menu using JavaScript

Is there a way to retrieve the selected text from a dropdown menu in HTML? Here is an example of the code: <select id="playerType" onchange="copy();"> <option value="0">Select one</option> <option value="1">Goalkeepers</option&g ...

What could be preventing the spinning cube from rendering in three.js?

While there are no errors showing up, the result is just a black screen. Due to the small size of the HTML and CSS code snippets, I suspect the issue lies within the JavaScript. // Creating a three.js scene: a 3D environment for objects const scene = new ...

Click on the text within a paragraph element

Is there a way to retrieve the selected text or its position within a paragraph (<p>)? I'm displaying a text sentence by sentence using a Vue.js loop of paragraphs. <p class="mreadonly text-left mark-context" v-for="line in ...

Props in Vue components are exclusively accessible within the $vnode

Exploring the realm of Vue.js, I am tasked with constructing a recursive Component renderer that transforms JSON into rendered Vue components. The recursive rendering is functioning smoothly; however, the props passed to the createElement function (code b ...

What is the process for linking read-only methods to Redux object instances?

Let's say I have a "user" object stored in redux, with fields for first name and last name (interface User { firstName : string, lastName : string} if using typescript). After retrieving a user from redux, I want to obtain the full name of the user by ...

Encapsulate the module function and modify its output

I am currently utilizing the node-i18n-iso-countries package and I need to customize the getNames function in order to accommodate a new country name that I wish to include. At the moment, I am achieving this by using an if-else statement like so: let cou ...

Implementing authentication middleware with React Router in a React component

Working on my app.js, I'm trying to implement an Auth component that acts as middleware to check if the user is logged in. const App = props => ( <BrowserRouter> <Provider store={store}> <div className="app"& ...

Angular's implementation of deferred only displays the final value in the loop

I've created a personalized synchronization process that queues up all my sync records in sequence. When my service retrieves multiple sync records, it processes them and updates the last sync date for successful records, or logs errors for failed rec ...

The connected callback does not trigger when custom HTML elements are being created

Attempting to craft a custom HTML tag using JavaScript, I aimed to create the custom element with ES6 JavaScript syntax. The code devised for this task reads as follows: customElements.define('neo-element', NeoElement); function NeoElement (){ ...

expand the div to fill the entire page

I am currently working on a webpage at . I have set the body and html to 100% height, as well as #site_main with a height of 100%. However, I am facing an issue where the #footer is not sticking to the bottom on screens with higher resolutions, leaving som ...

Choosing items within a category

For quite some time now, a question has been bothering me. I've been delving deeper into CSS lately and have made the decision to avoid using jQuery in this Drupal project to stay clear of custom code. The issue arises with a class that is applied to ...

Adjust the interval scope within an AngularJS directive to set up a loop

Within my agnularjs directive, I have an object containing the logic of a script: $scope.slider = { increment: 0, step: 1, positionTop: 0, init: function (step, isClick) { if(isClick) clearInterval($scope.interval); ...rest ...

Positioning two buttons with one on the left and the other on the right

I am currently looking to add an ADD button next to the VIEW button in this layout. An example of what I am trying to achieve can be seen at where you can click on the GRID VIEW icon. <div class="desktop_view product-view grid-list-row-view hide" sty ...

Unable to toggle visibility of div using Hide/Show function

I've noticed that the questions already posted do not solve my issue. I have a side menu bar displaying options and I want the content of the selected option to be displayed on the same page, while hiding the other div content. I have tried the follow ...

Updating data in Redux triggers a refresh of Material UI table data

Utilizing the material-ui data table component to showcase data, enabling users to update and save information via a form when clicking on a row. Implemented react-redux for state management and dispatching updated rows to the existing data. However, despi ...

Distinguish between closing a browser tab and refreshing it to identify various instances of the application

How do you differentiate between browser tab close and refresh functionality? Currently, window refresh and close events do not have separate events. My requirement is to check whether the user is already logged in on any tabs, so that I can prevent th ...

Guide for redirecting puppeteers' attention to a new pop-up interface

Currently, I am utilizing Puppeteer to carry out a test on a website. Upon clicking a button, a new popup browser window emerges displaying a report. Inside this new window lies data that I wish to extract. Is there a method for Puppeteer to switch its foc ...

Retrieving information from a database utilizing SQL queries

Looking for a way to list the number of orders and their total value without using sub-select in SQL? SELECT u.name, COUNT(o.id) AS order_count, SUM(oi.quantity * p.price) AS total_price FROM users u INNER JOIN orders o ON o.user_id=u.id LEFT JOIN ...