Bootstrap modal appearing under background

前端 未结 30 1294
离开以前
离开以前 2020-11-22 17:09

I have used the code for my modal straight from the Bootstrap example, and have included only the bootstrap.js (and not bootstrap-modal.js). However, my modal is appearing u

30条回答
  •  旧时难觅i
    2020-11-22 17:38

    A but late on this but here is a generic solution -

        var checkeventcount = 1,prevTarget;
        $('.modal').on('show.bs.modal', function (e) {
            if(typeof prevTarget == 'undefined' || (checkeventcount==1 && e.target!=prevTarget))
            {  
              prevTarget = e.target;
              checkeventcount++;
              e.preventDefault();
              $(e.target).appendTo('body').modal('show');
            }
            else if(e.target==prevTarget && checkeventcount==2)
            {
              checkeventcount--;
            }
         });
    

    Visit this link - Bootstrap 3 - modal disappearing below backdrop when using a fixed sidebar for details.

提交回复
热议问题