I've encountered a situation where I have an element styled with position:fixed
, and bottom: auto;
. When I apply the command .animate({bottom : '10%'});
, it smoothly slides to the specified position. However, when I try to set it back to its original position using .css('bottom','auto');
, the element instantly jumps back without a smooth transition.
Unfortunately, I am unable to use .animate();
for this task. Are there any alternative methods to achieve the desired effect without having to alter the element's class? One possible solution I considered was utilizing .toggleClass();
.
I also experimented with setting a longer -webkit-transition
time, but the element continued to move back instantaneously to its initial position.
An additional approach could involve saving the initial position in a variable and returning the element to that position. However, this method may not always be practical as the initial position can vary within the function.