问题
I have one form in modal and i format my select box with chosen jquery
I want to scroll div to top of modal body when i click on chosen container
My form is here
When clicking on chosen container i want this type of scroll by jquery
I tried to do like this:
//$(document).on('click','.search-field',function(){
$(document).on('click','.chosen-choices',function(){
console.log("ok");
// $(this).animate({scrollTop: $(this).closest('.modal-body').offset().top},'slow');
// $('body').animate({scrollTop: $(this).closest('.modal-body').offset().top},'slow');
$('.modal-body').animate({scrollTop: $(this).closest('.modal-body').offset().top},'slow');
// $(this).closest('.chosen-container').animate({scrollTop: $(this).closest('.modal-body').offset().top},'slow');
// $(this).scrollTop(0);
});
If I click on the project manager select box, then it should be fixed on top and if I click on the subcontractor then it should be fixed on top.
Please help me for doing this.
来源:https://stackoverflow.com/questions/44299271/scroll-and-set-div-on-top-in-modal-body-when-click-on-chosen-container