Scroll and set div on top in modal-body when click on chosen container

雨燕双飞 提交于 2019-12-11 05:27:04

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!