开发者

JQuery Simple Modal OSX Multiple dialogs

HI,

I'm planning to use the jquery Simple modal for login and registration on my project site. i tried to have 2 modals as mentioned here. but im still unable to make it work. here is my code

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();

I guess its something to do with the open: function part, anyone can help me ?


What is the problem? If you are using it on a ASP.NET site, make sure to use the appendTo: 'form' option.


duplicate

osx.js into -> osx2.js

and rename

input.osx2, a.osx -> input.osx2, a.osx2 osx-modal-content -> osx-modal-content2 osx-modal-data -> osx-modal-data2

a little more simplification, i guess?


Here is the solution I make out to modal window by creating and 2 object 1 is osx and other is rosx thats it !!!!

you can mail me @ miliwebdeveloper27@gmail.com for further assistance :) Happy to help always...

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜