JQuery Simple Modal OSX Несколько диалогов - PullRequest
1 голос
/ 06 апреля 2010

HI

Я планирую использовать модал jquery Simple для входа и регистрации на моем сайте проекта. Я пытался иметь 2 модальных как упоминалось здесь . но я все еще не могу заставить его работать. вот мой код

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, кто-нибудь может мне помочь?

Ответы [ 3 ]

1 голос
/ 10 апреля 2010

В чем проблема?Если вы используете его на сайте ASP.NET, обязательно используйте опцию appendTo: 'form'.

0 голосов
/ 27 июля 2012

дубликат

osx.js в -> osx2.js

и переименовать

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

немного больше упрощений, я думаю?

0 голосов
/ 09 ноября 2011

Вот решение, которое я создаю для модального окна путем создания, и 2 объекта 1 - это osx, а другой - rosx, вот и все !!!!

Вы можете написать мне @ miliwebdeveloper27@gmail.com для получения дополнительной помощи :) Рад всегда помочь ...

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