jeudi 1 juin 2017

Checked radio button and scrolltop

I have a form with a few steps - step 1, step 2, step 3 .... In step 1, there are radio buttons and, by selecting one of them, step 2 appears and scrolls to it. In step 2, I have a div with images and clicking on one of them it is scrolled to step 3 where there is a new group with inputs, but when set a value it scrolls to step 2 as I have chosen a radio button on step 1. It is the same if I select other radio button from other steps. I need to scroll to div only by click on one radio button. If I use click, it's working only on second click on the radio button.

//checkbox on step 1
if ($('#field_8nsvi-0').is(":checked")) { 

  // show step 2 content
  $('#golv').show();
  // scroll to step 2 content 
  $('html,body').animate({ 
   scrollTop: $("#golv").offset().top },'slow');
}
else {
  $('#golv').hide();
}




Aucun commentaire:

Enregistrer un commentaire