I am trying to move a DIV
with animation from center to left, and by default DIV
on click in jQuery
, where parent div is with position:relative
, what I was thinking is, onclick the parent DIV
position will be changed from relative to absolute and then run animate function, but it's not working, it's just shifting from center to left on click, no animation.
Here is the code which I am trying:
$("#bx1 > .column-wrapper-inner > a ").click(function(){
$(".custom-col-md-2").css({position: "absolute"});
$(".column-wrapper").css({position: "absolute"}).animate({left: '50px'}, "slow");
});
Note: I want to change the div position from relative to absolute only on click not by default, as by default elements are in grid.
Can any one please help with this!
UPDATE : Here is the JsFiddle
Thanks in advance.