2010-04-06 56 views
1

嗨,JQuery簡單模態OSX多個對話框

我正打算在我的項目網站上使用jquery Simple模式登錄和註冊。我試圖擁有2個模態,如here所述。但我仍然無法使其工作。這裏是我的代碼

jQuery(function ($) { 
var OSX = { 
    container: null, 
    init: function() { 
     $("a.osx").click(function (e) { 
      e.preventDefault(); 

      $(this.id + "_osx-modal-content").modal({ 
       overlayId: this.id+'_osx-overlay', 
       containerId: this.id+'_osx-container', 
       closeHTML: null, 
       minHeight: 80, 
       opacity: 65, 
       position: ['0',], 
       overlayClose: true, 
       onOpen: OSX.open, 
       onClose: OSX.close 
      }); 
     }); 
    }, 
    open: function (d) { 
     var self = this; 
     self.container = d.container[0]; 
     d.overlay.fadeIn('slow', function() { 
      $("#osx-modal-content", self.container).show(); 
      var title = $("#osx-modal-title", self.container); 
      title.show(); 
      d.container.slideDown('slow', function() { 
       setTimeout(function() { 
        var h = $("#osx-modal-data", self.container).height() 
         + title.height() 
         + 20; // padding 
        d.container.animate(
         {height: h}, 
         200, 
         function() { 
          $("div.close", self.container).show(); 
          $("#osx-modal-data", self.container).show(); 
         } 
        ); 
       }, 300); 
      }); 
     }) 
    }, 
    close: function (d) { 
     var self = this; // this = SimpleModal object 
     d.container.animate(
      {top:"-" + (d.container.height() + 20)}, 
      500, 
      function() { 
       self.close(); // or $.modal.close(); 
      } 
     ); 
    } 
}; 

OSX.init(); 

我猜它與open:function部分有關,任何人都可以幫助我?

回答

1

問題是什麼?如果您在ASP.NET網站上使用它,請確保使用appendTo:'form'選項。

0

這是我通過創建模式窗口所做的解決方案,以及2對象1是osx,其他是rosx多數民衆贊成它!

你可以寄給我@ [email protected]尋求進一步的幫助:)快樂總是幫助...

jQuery(function ($) { 
var OSX = { 
    container: null, 
    init: function() { 
     $("input.osx, a.osx").click(function (e) { 
      e.preventDefault(); 

      $("#osx-modal-content").modal({ 
       overlayId: 'osx-overlay', 
       containerId: 'osx-container', 
       closeHTML: null, 
       minHeight: 80, 
       opacity: 65, 
       position: ['0',], 
       overlayClose: true, 
       onOpen: OSX.open, 
       onClose: OSX.close 
      });    
     }); 
      $("input.rosx, a.rosx").click(function (e) { 
      e.preventDefault(); 

      $("#osx-modal2-content").modal({ 
       overlayId: 'osx-overlay', 
       containerId: 'osx-container', 
       closeHTML: null, 
       minHeight: 80, 
       opacity: 65, 
       position: ['0',], 
       overlayClose: true, 
       onOpen: OSX.open, 
       onClose: OSX.close 
      }); 

     }); 
    }, 
    open: function (d) { 
     var self = this; 
     self.container = d.container[0]; 
     d.overlay.fadeIn('slow', function() { 
      $("#osx-modal-content", self.container).show(); 
      $("#osx-modal2-content", self.container).show(); 
      var title = $("#osx-modal-title", self.container); 
      title.show(); 
      d.container.slideDown('slow', function() { 
       setTimeout(function() { 
        var h = $("#osx-modal-data", self.container).height() 
         + title.height() 
         + 20; // padding 
        d.container.animate(
         {height: h}, 
         200, 
         function() { 
          $("div.close", self.container).show(); 
          $("#osx-modal-data", self.container).show(); 
         } 
        ); 
       }, 300); 
      }); 
     }) 
    }, 
    close: function (d) { 
     var self = this; // this = SimpleModal object 
     d.container.animate(
      {top:"-" + (d.container.height() + 20)}, 
      500, 
      function() { 
       self.close(); // or $.modal.close(); 
      } 
     ); 
    } 
}; 
OSX.init(); 
}); 
0

複製

osx.js成 - > osx2.js

,並重新命名

input.osx2,a.osx - > input.osx2,a.osx2 OSX模態內容 - > OSX模態-內容2 OSX模態數據 - > OSX模態-DATA2

一點更簡化,我猜?

+0

歡迎使用Stack Overflow並感謝您的回答!但是......請你澄清一下嗎?這是如何使你有多個模態對話框?而且,它與TO仍然相關嗎? – 2012-10-11 01:03:25