Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
121
rated 0 times [  126] [ 5]  / answers: 1 / hits: 19848  / 11 Years ago, thu, january 9, 2014, 12:00:00

I'm trying to use jQuery to animate a div with a background picture decreasing in width from left to right whilst being absolutely positioned.



I need to make this compatible with IE8 hence using jQuery.



Here is a basic JSFiddle demo link with what I have so far, but it animates from right to left:



JSFiddle link



jQuery(document).ready(function($){
$(document).on('click', '.splat', function(e){
$(this).animate({width:0px},800);
});
});

.splat {
width: 400px;
height: 400px;
background: blue;
position: absolute;
top: 100px;
left: 100px;
}

<div class=splat><!-- --></div>


I need it going in a different direction, like the following image:



example



Hoping someone could point me in the right direction (no pun intended!). Thanks in advance.


More From » jquery

 Answers
14

You may use a wrapper and position the child div with right:0.



See this demo


[#73291] Wednesday, January 8, 2014, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
raveno

Total Points: 453
Total Questions: 92
Total Answers: 92

Location: France
Member since Thu, Oct 27, 2022
2 Years ago
raveno questions
;