I have the following problem:
Using .show()
and .hide()
the tool slides different panels into view, which
works fine. However the whole div
which is being animated, moves down a few
pixels while the animation is running.
Once the animation has finished (stopped running), the div
snaps back to the position it should be in.
This is the code for the animation (slide) I am currently using to get from Status A to Status B: ('Inputs shown' to 'Selects shown')
$(this).parent().find('#input').hide('slide',{ direction: "right" }, 400, function () {
$(this).parent().find('#select').show('slide',{ direction: "left" }, 400, function() {
$('#selectLabel').focus();
});
});
In the JSFiddle that I will link at the bottom of the question, you can also see the code for when I want to get back from Status B to Status A.
So far I have tried using .toggle()
instead of .show()
and .hide()
like this:
$(this).parent().find('#input').toggle('slide',{ direction: "right" }, 400, function () {
$('#selectLabel').focus();
});
and the other way around but the problem stays the same.
I also tried adding a min-height
of 500px to the wrapping div
's but once again, the problem stays the same. The animated div
moves down and snaps back up in the end.
Removing classes didn't help as well.
jQuery: bootstrap jquery 1.11.3
jQueryUI: bootstrap jqueryUI 1.11.4
Bootstrap: 3.1
I am not sure if it makes a difference but the javascript is being loaded from inside the body and not the head.
As promised here the link to the JSfiddle: https://jsfiddle.net/tjky76wp/
Anyone an Idea what I am doing wrong? How can I prevent the animated div
to move up while it is being animated?
EDIT:
I just realized that I gave u guys the link to an outdated JSFiddle, here the correct one: https://jsfiddle.net/tjky76wp/1/
, when you remove it, it works smoothly. I don't know the reason but hr is the problem. – Burak Karakuş Sep 28 '17 at 13:03