Unexpected behavior observed when animating CSS transform in IE

I am currently facing an issue with a CSS animation on my website that animates an arrow back and forth. The animation is working perfectly on all browsers except for Internet Explorer, where there seems to be a glitch causing the Y position of the arrow to change unexpectedly.

$(function() {
  $('button').click(function(e) {
    e.preventDefault();
    $('img.next').addClass('animated');
  });
});
.arrow-cont {
  height:100%;
  width:130px;
  position:absolute;
  right:0;
  top:0;
  cursor:pointer;
  overflow:hidden;
}
img.next {
  width:30px;
  position:absolute;
  top:50%;
  right:20px;
  animation-duration:1.5s;
  animation-timing-function:ease-in-out;
  transition:0.5s all ease-in-out;
}
  img.next.animated {
    animation-name:next;
    animation-iteration-count:infinite;
  }

@keyframes next {
    from { transform:translate(0px, -50%); }
    65%  { transform:translate(10px, -50%); }
    to   { transform:translate(0px, -50%); }
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="arrow-cont">
<img class="next" src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/45/Arrow_Blue_Right_001.svg/768px-Arrow_Blue_Right_001.svg.png" />
</div>


<button>Animate</button>

Answer №1

Consider trying to set the properties translateX and translateY individually.

Additionally, it seems unnecessary to have transition:0.5s all ease-in-out as nothing is actually transitioning. Therefore, I have removed this line of code for you.

$(function() {
  $('button').click(function(e) {
    e.preventDefault();
    $('img.next').addClass('animated');
  });
});
.arrow-cont {
  height: 100%;
  width: 130px;
  position: absolute;
  right: 0;
  top: 0;
  cursor: pointer;
  overflow: hidden;
}

<img.next {
  width: 30px;
  position: absolute;
  top: 50%;
  right: 20px;
  animation-duration: 1.5s;
  animation-timing-function: ease-in-out;
  transform: translateY(-50%) translateX(0px);
}

img.next.animated {
  animation-name: next;
  animation-iteration-count: infinite;
}

@keyframes next {
  from {
    transform: translateY(-50%) translateX(0px);
  }
  65% {
    transform: translateY(-50%) translateX(10px);
  }
  to {
    transform: translateY(-50%) translateX(0px);
  }
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="arrow-cont">
  <img class="next" src="https://upload.wikimedia.org/wikipedia/commons/thumb/4/45/Arrow_Blue_Right_001.svg/768px-Arrow_Blue_Right_001.svg.png" />
</div>


<button>Animate</button>

Answer №2

To improve the functionality, consider updating your IE 11 Browser to a newer version. I was unable to find the IE 11.0.9600.19129 package, but I successfully tested your code on IE 11.0.9600.19155 and IE 11.1.17134.0 versions which both worked flawlessly. Therefore, I recommend using these versions or upgrading to the latest one for optimal performance.

https://i.sstatic.net/dwfL5.gif

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

Issue with Bootstrap columns being misaligned on mobile devices

On my website, I've implemented a Bootstrap Grid design with three columns under the container-fluid BS attribute, along with .row .no-gutters. While the boxes are perfectly aligned in the desktop view, they stack vertically on mobile and tablet devi ...

Social media comments widget

Currently, I am incorporating the Facebook XML to implement a Facebook comments plugin within my MVC 3 application in the following manner: <fb:comments href="@Request.Url.AbsoluteUri" num_posts="15" width="900"></fb:comments> The issue lies ...

Adhering to a modular approach to design

I am facing an issue with two modules: One is the .master-header and the other is the .header-nav The .header-nav is contained within the .master-header and consists of a simple navigation menu: <nav class="header-nav"> <ul> ...

What is the best way to stop vertically aligned elements from overlapping the navbar in Bootstrap 4?

I have successfully aligned my content vertically, but I encountered an issue when resizing the browser window vertically - the aligned content overlaps with the navbar. What I want is for the vertically aligned content to stop at the navbar. I have exper ...

Can I create a div with a rounded right side?

Is there a way to give a div a slightly rounded right side using CSS? If so, can you show me how in this fiddle template: http://jsfiddle.net/z2hejemu/ HTML <div class="rounded-side"> <p>By default, this div is rectangular. I would like t ...

React - Highcharts Full Screen dark overlay

I am currently working on integrating highcharts/highstock into my application, and I have encountered an issue with the full screen functionality. The challenge I am facing is setting a fixed height for my charts while also enabling the option to view ea ...

Does the 'span' element negatively impact the vertical alignment of text?

While working on my code, I noticed an issue with vertical alignment when using span tags to change the background of the text based on its content. The problem occurs specifically when viewing the code in the Android Chrome browser. You can view the initi ...

ReactStrap: Difficulty concealing navbar item based on screen dimensions

Currently, I am referring to the official documentation to implement a scenario where a NavItem is only displayed for screen sizes greater than sm. As per the guidelines provided in the documentation, I have included the following attributes: https://i ...

What is the most effective method for implementing a background repeated image in Foundation 4 framework?

Currently, I am utilizing the foundation4 framework for my website. In order to achieve a repeating tiled background, I have crafted a custom CSS file and included the following code snippet: body { background: url(img/floorboardsbg.jpg) repeat; } Whi ...

Maintaining the relative position of an SVG while scaling within a div element

I am in the process of incorporating my custom SVG knob icons into an electron application using flexbox. The challenge lies in keeping them centered within the rectangle icon regardless of browser size, as shown here. Ideally, the icons should adjust thei ...

Eliminating the final space in CSS flexbox layout

When I set the display of an element to flex, I noticed that the last space in a text string gets removed. <div class="has_flex"> Some text <a href="link">Link</a></div> After setting display to flex: <div class="has_flex"> ...

Universal CSS styling for scrollbar design across platforms

I'm feeling extremely frustrated right now because I can't seem to create a basic scroll bar with a specific color and thickness that will display properly on various web browsers and smartphones. Are there any resources available to help me fig ...

Positioning two divs side by side, with two more below in the following row

I am attempting to align multiple div elements with a width relative to the screen size. However, when I try to float them next to each other, they shift to the right and display under each other. I have experimented with applying display: inline-block; a ...

At 400 pixels screen size, the buttons in the appBar component are spilling out

In my appBar component, I have three buttons that appear fine on large screens. However, when the screen size reaches 400px, they start stretching out of the appBar. Here is how they look on large screens: https://i.sstatic.net/l3nJM.png And this is how ...

Hovering over elements with the FireFox CSS transition 'transition-all' can sometimes lead to flickering and unexpected behavior

Can someone help me understand why I am experiencing a flickering effect on an element when using transition: all 0.5s ease-out; in FireFox? It's difficult to describe, but you can see it happening in this live example here: (take a look at the logo ...

Increasing the boundary width beyond a specified limit with CSS

Need help extending the border-top of an element beyond a container width set to 1024px, while maintaining center alignment on the page with left alignment. Thank you! Here is the code snippet: HTML <main> <div> <span>Hello& ...

JavaScript Animation of Text

I have a challenge where I want to animate text's opacity in JavaScript after the user presses enter. However, I am struggling to achieve this with my current code. I can provide all of my code for you to review and help me understand why the animatio ...

Label text will not be wrapped in front of the label (bootstrap)

I'm struggling with some css coding. I want the text to wrap so the label is positioned on the middle right of the box, similar to this example: https://i.sstatic.net/RBIOS.png. However, currently it looks like this: http://jsfiddle.net/yuvemL1z/ and ...

Challenges arise with the safari navigation bar within a PWA platform

Struggling with the formatting and spacing issues of a PWA application on IOS devices due to notches and navbar heights. One specific problem is that a chat input with absolute positioning and bottom: 0 does not display properly in Safari because of the n ...

What is the best way to include some white space around a paragraph?

Can anyone help me figure out how to add margins to my paragraphs with borders on a website? I've tried using margin in CSS, but it's not working. Here is the HTML code I am using: body{ margin:0px; font-family:Calibri; background ...