2010-04-06 57 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