2017-06-06 39 views

回答

0
<script language="javascript"> 
    this.getTopWindow(window).ui_confirm(content); 

    function ui_confirm(msg, confirm, cancel){ 
     bootbox.dialog({ 
      message: "<h5>"+msg+"<h5>", 
      animate: false, 
      closeButton: false, 
      size: "small", 
      buttons: { 
       main: { 
        label: "取消", 
        className: "btn-inverse btn-sm", 
        callback: function() { 
         if (typeof cancel !== "undefined" && Object.prototype.toString.call(cancel) === "[object Function]") { 
          cancel(); 
         } 
        } 
       }, 
       danger: { 
        label: "確定", 
        className: "btn-primary btn-sm", 
        callback: function() { 
         if (typeof confirm !== "undefined" && Object.prototype.toString.call(confirm) === "[object Function]") { 
          confirm(); 
         } 
        } 
       } 
      } 
     }); 
    } 
</script> 
1
var scrollTop = window.gui.getTopWindow(window).scrollY; 
if(scrollTop > 200){ 
    $('#modalId').find('.modal-content').css('top',(scrollTop-50)+'px'); 
} 
$('#modalId').modal({ 
    show:true, 
}) 
+0

謝謝,它的工作原理。 – fusu

1
$('#modalId').modal({ 
    show:true, 
}).css({ 
    'margin-top': function(){ 
     return window.gui.getTopWindow(window).scrollY; 
    } 
});