ginobiliiiiiiiiii ginobiliiiiiiiiii - 6 months ago 11
Javascript Question

Slidedown form on click

I am trying to show form when user clickes on the button. Form is showing up but there seems to be a bug for a second. form is centered when the slide up function is executing and when it is done it fits normally to the page.

Here is the js:

$(document).ready(function() {
$('.clicked').on('click', function(e) {
var current = $(e.target).next();
var show = current.hasClass('hidden');

if (show) {
current.hide();
current.removeClass('hidden');
current.slideDown('slow');
} else {
current.slideUp('slow', function() {
current.addClass('hidden');
current.slideUp('slow');
});
}

})
});


I do not think there is any bug in js code, most likely missing something in css.

Have a look here and click on blue button "Click Here" http://codepen.io/nikasv/pen/vKEEZr

Thanks.

Answer
.trip-form{
    width: 100%;
  overflow:hidden;
}

will do the trick even with the shaking you experience :)

Comments