When the jQuery Div is moved to the right, it gradually shrinks in size, yet remains unchanged when

I have been making updates to this page, which you can view here. When you select "Let's Get Started" and then proceed with the right arrows, the divs smoothly move to the left without shrinking. However, when clicking on the back or left arrows, the div moves correctly to the right but unfortunately shrinks in size, which is not the desired effect.

Is there a way to prevent the divs from shrinking when moving to the right? I've adjusted the CSS so that the div does not slide completely off the page for better visibility of the issue.

Below is the jQuery code responsible for handling the animations:

function forward(){
  console.log("forward function executed");
  // debugger;
  console.log("current page before incrementing: " + page);  
  $('#' + page).addClass( "gone_left", 1000, "swing" );
  page = page + 1;
  $('#' + page).removeClass("gone_left gone_right");
  console.log("current page after incrementing: " + page);
  manageChevrons();
}

function back(){
  console.log("back function executed");
  // debugger;
  console.log("current page before decrementing: " + page);   
  $('#' + page).addClass( "gone_right", 1000, "swing");
  page = page - 1;
  $('#' + page).removeClass("gone_left gone_right");
  manageChevrons();
}

The manageChevrons function simply handles the display of the right and left arrows.

Next, here is the relevant CSS code:

@media only screen and (min-width: 900px){
html {
    font-size: 18px;
  }
}

.no_overflow {
  overflow: hidden !important;
}

.gone_left {
    left: -5% !important;
}

.gone_right {
    left: 90% !important;
}

.card_center {
  position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) translateX(-50%) !important;
    left: 50%;
}

Finally, here is the HTML structure of the page:

<html>
<script
  src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"
  integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU="
  crossorigin="anonymous"></script>

<body class="no_overflow">

  <div class="container top-pad">
    <div class="row">
      <div class="col s4">
        <%= image_tag "logo.png", class:"responsive-img" %>
      </div>
    </div>
  </div>

<div class="container">
  <div class="row valign-wrapper">
    <div class="left_chevron">
      <i id="chevron_left" class="waves-effect waves-circle large material-icons purple-text text-darken-4 hidden left_chevron">chevron_left</i>
    </div>

      <div id="3" class="card large card_center">
        <div class="card-image">
          <%= image_tag "3.png" %> 
          <span class="card-title"></span>
        </div>
        <div class="card-content card_position">
          <p>This is #4
            <ul>US: xxx</ul>
            <ul>EU: xxx</ul>  
          </p>
        </div>
      </div> <!-- end of fourth card -->

      <div id="2" class="card large card_center">
        <div class="card-image">
          <%= image_tag "2.png" %> 
          <span class="card-title"></span>
        </div>
        <div class="card-content card_position">
          <p>You will need to get carrier calculated shipping
            enabled on your store. Its free if you signed
            up for the annual plan, otherwise its just $20/month.
            Call Shopify to enable it:
            <ul>US: xxx</ul>
            <ul>EU: xxx</ul>  
          </p>
        </div>
      </div> <!-- end of third card -->

      <div id="1" class="card large card_center">
        <div class="card-image">
          <%= image_tag "1.png" %> 
          <span class="card-title"></span>
        </div>
        <div class="card-content card_position">
          <p>For $25/month we fulfill an unlimited number of
            orders, so you don't have too.</p>
        </div>
      </div> <!-- end of second card -->      

      <div id="0" class="card large card_center">
        <div class="card-image"> 
          <%= image_tag "hi.png" %> 
          <span class="card-title"></span>
        </div>
        <div class="card-content card_position">
          <p>Welcome to FBA Shipping by ByteStand.
            A super simple way to automate fulfilling FBA items
            in the US and abroad.</p>
        </div>
        <div class="card-action">
          <button id="first_button" class="waves-effect btn stroke-btn tap">Let's Get Started!</button>
        </div>
      </div><!-- end of first card -->


    <div class="right_chevron">
      <i id="chevron_right" class="waves-effect waves-circle large material-icons purple-text text-darken-4 hidden right_chevron">chevron_right</i>
    </div>
    </div> <!-- end of main row -->
  </div> <!-- end of container -->

  </body>
</html>

Answer №1

To modify the CSS class named .card, delete the "max" part from "max-width:500px;"

Simply change it to "width:500px;" and you're done.

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

Using JQuery for sliding left without having to use inline CSS

I am dealing with a situation on my website where I need to hide a sidebar when clicked. $('#sidebar').toggle('slide', 'left', 300) In addition, I have implemented a CSS style to hide the sidebar on mobile devices. #sidebar ...

Animation using CSS keyframes for simultaneous manipulation of various properties

I am facing a challenge with animating both the bottom and left properties of an object inside a container div simultaneously. How can I make it move diagonally? Despite using keyframes, the following code does not seem to achieve this effect: #containe ...

Issue with Div element not appearing on Azure AD B2C page customization

Utilizing PopperJS, I attempted to incorporate a popover box that appears when the user focuses on the password field within an Azure AD B2C page customization. Despite noticing the presence of the box element, it fails to display as intended. Any assistan ...

attempting to eliminate on-screen buttons by hovering over the video

Is there a way to make my video play on loop like a GIF without the controls ever showing? I want it to have a seamless playback experience. Any ideas would be appreciated. P.s. Don't worry about any StackOverflow errors when running the snippet. Than ...

Avoid triggering the parent modal to close when a child element is clicked in VueJS

In my Vue application, there is a situation where I have a button called "detach button" with a @click function inside an element that is clickable. When clicking on this parent element, it triggers another @click function and toggles a Bootstrap modal eve ...

Stop the div from collapsing when hiding or deleting all child elements to maintain its structure

I have recently developed a Vuetify application that manages card items. To ensure security and accessibility, I have added a feature where the actions/buttons are displayed based on the User's permissions. In case of missing permissions, these button ...

Increase the jQuery Array

After successfully initializing an Array, how can I add items to it? Is it through the push() method that I've heard about? I'm having trouble finding it... ...

Named Graph's Title on Image Save in Echarts

Is there a way to give a title to the image graph saved in Echarts, as Echarts does not have this option available? Any suggestions on how we can achieve this? Here is a link for reference from Echarts that provides the 'saveAsImage' option: Ch ...

The function data() is coming back as null

This is the code snippet I am working with: $.getJSON("link here", function (result) { $.each(result, function (i, value) { $('.usersOfGroupList').append($("<li id='userElement' data-userId='' ></li>") ...

Guide to placing an element behind text using Bootstrap 3

On my webpage, I have a straightforward Bootstrap Jumbotron displayed prominently: <div class="jumbotron"> <div class="container"> <h1>Welcome to My Wonderful Site</h1> <p>There's some information her ...

Rails successfully processed the request with a 200 OK status code, however, the $.ajax() function is triggering the 'error' callback instead of the 'success' callback

In my controller, the ajax request is handled as shown below (simplified): def create ... @answer = Answer.new(video: video_file) if @answer.save render json: @answer.video.url else ... end end This is how I have defined my ajax function: $.aja ...

Display a specific paragraph inside a div using jQuery

I am having trouble getting my jQuery code to display a specific paragraph when a particular div is clicked on. My goal is for the content "v" to be displayed if the user clicks on the ".Virus" div, and for the contents of ".screenInfo" to be shown if the ...

Display various sets of data from multiple models within a single view

My project is focused on Asp.net Mvc and I am encountering a challenge in displaying multiple model data in one view. However, I do not want to showcase it in a list or grid format, instead, I prefer a Form View style. The two modal classes involved are Pr ...

Can you explain the expected behavior of the ::before and ::after pseudo-elements when used with the <details> element?

I observed that the <details> element is rendered differently in Chrome and Firefox. Take a look at the code sample below. According to the HTML Standard: The first summary element child of the details element represents the summary or legend of the ...

Display a bootstrap toast using a JavaScript class method

One way to display a bootstrap toast is by using the following code snippet: let my_toast = new myToast('title', 'hello world'); my_toast.show(); Currently, I am loading the HTML content from an external file named myToast.html: < ...

When trying to implement appDir and withPWA in next.config.js, an error has been encountered

My next.config.js is set up with next-pwa and an experimental app feature included. const withPWA = require('next-pwa'); module.exports = withPWA({ pwa: { dest: 'public', disable: process.env.NODE_ENV === 'development&ap ...

Javascript window.scroll function malfunctioning in some browsers while running in localhost

Check out this codepen link where everything is working, but unfortunately not locally: https://codepen.io/LoudDesignStudios/pen/RwxPJKY <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> < ...

A step-by-step guide on utilizing img src to navigate and upload images

I would like to hide the input type='file' element with id "imgInp" that accepts image files from users. Instead, I want them to use an img tag to select images when they click on a specific img tag. How can this be achieved using jQuery? Here i ...

Customize your QTabBar icons with Qt Stylesheet: Adjusting the icon mode

I am currently working on customizing a QTabBar with a stylesheet in my tool. I use QIcon to create icons for the tabs, allowing me to set different modes such as normal, disabled, and selected. The challenge I am facing is trying to apply a global stylesh ...

Pinterest's "Pin it" button causing issues with the 'back' function in Internet Explorer

Recently, I discovered a problem with the "Pin it" button for Pinterest in Internet Explorer (v9 at least). It seems that this button is causing issues with the 'back' functionality in the browser. When right-clicking on it, an entry like '& ...