bootstrap jquery show.bs.modal event won't fire

前端 未结 19 2449
小蘑菇
小蘑菇 2020-11-28 07:29

i\'m using the modal example from the bootstrap 3 docs. the modal works. however i need to access the show.bs.modal event when it fires. for now i\'m just trying:



        
19条回答
  •  臣服心动
    2020-11-28 07:43

    Similar thing happened to me and I have solved using setTimeout.

    Bootstrap is using the following timeout to complete showing:

    c.TRANSITION_DURATION=300,c.BACKDROP_TRANSITION_DURATION=150,

    So using more than 300 must work and for me 200 is working:

    $('#myModal').on('show.bs.modal', function (e) {
        setTimeout(function(){
            //Do something if necessary
        }, 300);                        
    })
    

提交回复
热议问题