Show div with animation left to right

Sanjeev Kumar

I have a page where I want to show the div with slide in effect from left to right, but this is working opposite, right to left, not sure whats wrong here, can somebody please look?

$(document).ready(function() {
  $("#wrapper").animate({
    right: '100%'
  }, 'slow');
});
#wrapper {
  position: fixed;
  z-index: 101;
  top: 0;
  color: #fff;
  font-weight: bold;
  font-size: 10px;
  height: 50px;
  width: 100%;
  min-width: 50px;
  background: red;
}
<div id="wrapper">
  Content goes here..
</div>

Zay Lau

You are trying to tell the jQuery to animate the element from right: 0; to right: 100%; which is moving the element distance 0 from right to 100% from right, so it is a right to left animation.

You probably would have to set the element initial state to right: 100% and jQuery animate to right: 0 to get the effect

I have implemented a CSS version here that initalized #wrapper { right: 100%; transition: 1s; }

and set the position by applying class to it #wrapper.animate { right: 0; }

all you have to do is toggling the class of your element $("#wrapper").addClass("animate");

try it on https://jsfiddle.net/d1m9hrx5/

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to show left div below right div?

From Dev

show and hide div from right to left in jquery

From Dev

show and hide div from right to left in jquery

From Dev

Webkit animation move only right edge of a rectangular div to the left

From Dev

how div show smoothly left to right using only CSS?

From Dev

Android animation view right to left

From Dev

jQuery - Image animation (right to left)

From Dev

Scroll left / right an image with animation

From Dev

Creating a slideshow with left to right animation?

From Dev

Jquery animation and css right and left

From Dev

Text Underline Animation Left to Right

From Dev

Android animation view right to left

From Dev

Segue with animation from left to right

From Dev

Align div left and right

From Dev

Slide Div Left to Right

From Dev

How to make an outside div come from left on click and on ri-click go to right with jQuery toggle and animation?

From Dev

hide/show div with animation

From Dev

Floating left and right: left div is below right div

From Dev

Moving a div right animation not working

From Dev

Animate div from left to right

From Dev

Append div from right to left

From Dev

Slide DIV Right to Left with jQuery

From Dev

Sliding a div from right > to left <

From Dev

Animate div from left to right

From Dev

Sticky div on left, scroll on right

From Dev

Populate Div from Left to Right

From Dev

How to achieve right to left animation to start the activity

From Dev

Swipe animation from left to right infinite time

From Dev

How to make a right to left animation in a layout