Having trouble with making a responsive flip animation in jQuery

I've been attempting to implement a responsive flip card animation using the resources at , but I'm encountering an issue. The back side of the card is set to 100% width, and when I try to adjust it to 33.333%, the layout gets disrupted.

If anyone could provide some assistance, it would be greatly appreciated!

$(function(){
    $("#card").flip({
        trigger: 'hover'
    });
});
.albumbox img {
height: 450px;
object-fit: cover;
}

.albumbox {
height: 450px;
}


#card {
margin: 0 auto;
height: 450px;
width: auto;
}

#card .back {
    background: #2184cd;
    color: #fff;
    text-align: center;
}
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>

<script src="https://cdn.rawgit.com/nnattawat/flip/v1.0.20/dist/jquery.flip.min.js"></script>

<main>
    <div class="row">
    <h2>Singles <i class="material-icons">album</i></h2>
        <div id="card">
            <div class="albumbox col-4 front">
                <img src="http://theblueliar.com/wp-content/uploads/2015/07/Jessie-J-012.jpg">
            </div>
            <div class="albumbox4_detail back">
            detail back
            </div>
        </div>
            <div class="albumbox albumbox5 col-4">
        <img src="http://theblueliar.com/wp-content/uploads/2015/07/Jessie-J-012.jpg">
        </div>
            <div class="albumbox albumbox6 col-4">
            <img src="http://theblueliar.com/wp-content/uploads/2015/07/Jessie-J-012.jpg">
        </div>
    </div>
</main>

Answer №1

Incorporate the following CSS:

.albumbox img{
    height: 450px;
    object-fit: cover;
    max-width: 100%;
}

When the original size of the image is larger than the container width, it may cause scrolling. By setting the max-width on the img tag, you can prevent it from exceeding the parent width and make it responsive.

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

What is the best way to create a read-only input field?

https://i.sstatic.net/36h6s.png The code I attempted to use did not produce the desired result <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="91f3fefee5e2e5e3f ...

Show the Select component in a grid format with a list view, displaying three items per row

Within my react Dropdown component, there is currently a list view displayed when an item is selected. However, I am looking to modify it so that the items are arranged in a grid format with 3 items per row. Sample Code: import { Dropdown } from 'pri ...

Finding the initial visible iFrame in a browser window and displaying its content

It's quite a strange situation... This issue only pertains to IE8 and older versions. So, there's this iFrame that's popping up (and I have no way to control or assign an ID to it), thank you Telerik! // The only way to target it would be: ...

I need some assistance, please. Can someone explain why the Bootstrap card is staying aligned to the left in mobile view

I've tried everything, but it's still not working. Can anyone help me out? Here are some photos. BEFORE AFTER When I view the card on mobile, I want it to stay centered. Could there be some missing code that I'm overlooking? I would great ...

Selenium is unable to activate the button element by clicking

I have been using Selenium with Python and attempting to click a button, but it simply isn't working. Here is the relevant HTML: <div class="nmMym"> <button class="sqdOP yWX7d _8A5w5 " type="button"> ...

Tips for adjusting the HTML font size in Bootstrap 4 while maintaining a responsive navbar

Attempting to scale a webpage the Bootstrap 4 way by using html font-size and rem everywhere else seems to be causing issues with the responsive navbar activation. The problem arises when the view is scaled down; the responsive navbar fails to hide the men ...

Creating a sleek and modern look with Bootstrap 4: The Transparent sticky

Currently in the process of developing a webpage with sticky navigation. The main challenge I am facing is that I have multiple sections with background images and a transparent navigation bar. It's crucial for the logo to be displayed above the navig ...

Utilize jQuery to refresh the database with the information retrieved from the ajax-request

I am attempting to update the database. This is what I am doing From my JavaScript code var data = { "jobid": $('#jobid').val(), "names": $('#names').val(), "scripttype": $('#testscripts').val() }; var msg=""; f ...

The Bootstrap star-rating display duplicated on the page

I have integrated a plugin to display star ratings on my Bootstrap website. Here is a snippet of the modal code where I have included the star rating input element: <div class="modal-header"> <button type="button" class="close" dat ...

The Move-class only applies to items within a transition-group that have not been removed if other items were removed

My item list is displayed in a flex-box, forming a matrix with several rows and items per row. I use the <transition-group class="move"> to apply a simple move transition to the <div v-for="item in items" :key="item.id"> move { transition: t ...

Is there a way to automatically scroll to a sidebar item when clicking on a marker?

Is it possible to make the sidebar scroll to the item clicked on the marker? I saw this functionality on a website like this one. Any ideas on how to achieve this would be appreciated. Thanks! This div contains map id & side_bar id. <div style="wi ...

Using jQuery to change the color of a child element based on a data attribute

Can anyone suggest a solution for this issue? $("div[data-color]").each(function() { $(this).children('p').css('color', function () { return $(this).data('color') }); }); Here is the structure of the code: ...

Connecting users from a mobile website to a particular item within the Amazon application

Recently, I've been working on linking from my mobile site to a particular item within the Amazon app. My JavaScript code includes a try/catch block that redirects users to the webpage if they don't have the app installed. However, I've foun ...

Clicking on a row in the Gridview should trigger the expansion or collapse of the Nested

My current issue involves a nested GridView setup like this: <asp:GridView ID="gvParent" runat="server" DataKeyNames="id"> <Columns> <asp:TemplateField> <ItemTemplate> <asp:GridView ID="gv ...

Troubleshooting: Issues with window.location.href and window.open within an iframe

Code Update <div> <button type="button" class="submit btn btn-default" id="btnSubmit">Submit </button> <button type="button">Cancel</button> </div> <script> $("#btnSubmit").click(function(e) { ...

Making a page jump with Javascript

Welcome! Let's dive into our question. Below you'll find my script and HTML code: My Script: const resultEl = document.querySelector('.allquotes'); const pageSize = document.querySelector('select[name="page-size"]') ...

Bring in the SCSS directory from the overarching SCSS program

I am currently working with Angular (Jhipster) in my application and I am looking to include multiple .scss files in my global.scss file. To achieve this, I have created a folder called "util" at the same level as the global.scss file and placed these .scs ...

Utilizing the Bootstrap carousel feature to display a maximum of 8 items per slide

I am working on a project where I need to dynamically generate an array of objects. These objects will be displayed using the Bootstrap carousel, with 8 objects shown on each slide. If there are more than 8 objects, the extras should move to the next slide ...

Retrieving JSON data using a jQuery AJAX call

I'm struggling with parsing JSON data from a PHP file to jQuery. I've been searching for the right method, but it's been challenging. Any assistance would be greatly appreciated. It must be done within a function. Currently, I have reached ...

Struggling to set the value for a variable within an Angular factory?

When dealing with a variable as an array, I have no trouble pushing objects inside and retrieving the values within the controller. However, when trying to directly assign an object to that variable, I run into issues. If anyone can assist me in achieving ...