powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / HTML, JavaScript, VBScript, CSS [игнор отключен] [закрыт для гостей] / jQuery dialog. windows system
2 сообщений из 2, страница 1 из 1
jQuery dialog. windows system
    #38661731
RomanH
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Добрый день уважаемые джаваскриптеры!
столкнулся с javascript и понял что работа Ваша нелегка! Ни как не могу его освоить после c#.
помогите пожалуйста реализовать две функции: maximize и unmaximize .
итак имеется.
css:
Код: css
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
.ui-dialog .ui-dialog-titlebar-maximize { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 20px 0 0; padding: 1px; height: 18px; }
.ui-dialog .ui-dialog-titlebar-maximize span { display: block; margin: 1px;  }
.ui-dialog .ui-dialog-titlebar-maximize:hover { padding: 1;}
.ui-dialog .ui-dialog-titlebar-maximize:focus { padding: 1;}


.ui-dialog .ui-dialog-titlebar-minimize { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 42px 0 0; padding: 1px; height: 18px; }
.ui-dialog .ui-dialog-titlebar-minimize span { display: block; margin: 1px;}
.ui-dialog .ui-dialog-titlebar-minimize:hover { padding: 1;}
.ui-dialog .ui-dialog-titlebar-minimize:focus { padding: 1;}


.ui-taskbar { padding:2px 0 2px 4px; text-align:left; cursor: pointer }


.ui-taskbar .ui-taskbar-tile-my 
{ 
	float: left;
	padding: 5px 10px;
	font-size: 12px;
	cursor: pointer;
	margin-right: 2px;
	width:180px;
	position: relative;
}


html:
Код: html
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
<!doctype html>
<html>
<head>
    <meta charset="utf-8" />
    <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/smoothness/jquery-ui.css" />
    <link rel="stylesheet" type="text/css" href="../css/jquery.taskbar.css" />

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/jquery-ui.js"></script>
    <script src="../src/jquery.taskbar.js"></script>
    <script>
        $(function() {
            var i = 1;
            $("#makedlg").click(function() {
                $("#dialog").clone().attr("id", "dialog" + i).attr("title", "My window " + i).taskbardialog({
                    taskbar: "#taskbar"
                });
                i++;
            });
        });
    </script>	

    <style type="text/css">
        body {
            margin: 0;
            padding: 0;
        }
    </style>
</head>
<body>
<label for="makedlg"></label><input type="button" id="makedlg" value="Open window"/>

<div id="dialog" class="buzzilla" title="buzzilla dialog" style="display: none">
    <fieldset title="Just a field set">
        <p><label>Name: <input type="text"></label></p>
        <p><label>Sex:
            <input type="radio" name="sex" value="M">Male
            <input type="radio" name="sex" value="F">Female
        </label></p>
    </fieldset>
</div>
<div id="taskbar" style="position:absolute; bottom:0;width:99%; height:30px;background:lightblue; z-index: 3000; border: 1px solid black">   
</div>
</body>
</html>


ну и собствено javascript:
Код: javascript
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
145.
146.
147.
148.
149.
150.
151.
152.
153.
154.
155.
156.
157.
158.
159.
160.
161.
162.
163.
164.
165.
166.
167.
168.
169.
170.
171.
172.
173.
174.
175.
176.
177.
178.
179.
180.
181.
182.
183.
184.
185.
186.
187.
188.
189.
190.
/*
* jQuery Taskbar UI Widget 1.0
* Copyright (c) 2011 Buzzilla 
*
* Depends:
*   - jQuery 1.4.2+
*   - jQuery UI 1.8 widget factory
*
* Optional:
*   - jQuery UI effects
*   - jQuery UI position utility
*
* Dual licensed under the MIT and GPL licenses:
*   http://www.opensource.org/licenses/mit-license.php
*   http://www.gnu.org/licenses/gpl.html
*
*/
(function ($, undefined) {

    $.widget("buzzilla.taskbardialog", $.ui.dialog, {
        options: {  taskbar: null  },

        _create: function () {
            $.ui.dialog.prototype._create.apply(this, arguments);

        var self = this,
        options = self.options,

		uiDialogTitlebar = self.uiDialogTitlebar           
                        .focus(
                            function () {
                                uiDialogTitlebar.addClass('ui-state-hover');
                            },
                            function () {
                                uiDialogTitlebar.removeClass('ui-state-hover');
                            }
                        ),

            maximizeButton = $("<a id='maxButton' href='#'></a>")
                        .addClass("ui-dialog-titlebar-maximize  ui-corner-all")
                        .attr("role", "button")
                        .hover(
                            function () {
                                maximizeButton.addClass('ui-state-hover');
                            },
                            function () {
                                maximizeButton.removeClass('ui-state-hover');
                            }
                        )
                        .focus(function () {
                            maximizeButton.addClass('ui-state-focus');
                        })
                        .blur(function () {
                            maximizeButton.removeClass('ui-state-focus');
                        })

                        .click(function (event) {                            
                            self.maximize(event);                            
                        })
                        .appendTo(self.uiDialogTitlebar),
            
			maximizeButtonText = (self.maximizeButtonText = $("<span>"))
                        .addClass("ui-icon ui-icon-extlink")
                        .text("maximize")
                        .appendTo(maximizeButton), 
            
            minimizeButton = $("<a id='minButton' href='#'></a>")
                        .addClass("ui-dialog-titlebar-minimize  ui-corner-all")
                        .attr("role", "button")
                        .hover(
                            function () {
                                minimizeButton.addClass('ui-state-hover');
                            },
                            function () {
                                minimizeButton.removeClass('ui-state-hover');
                            }
                        )
                        .focus(function () {
                            minimizeButton.addClass('ui-state-focus');
                        })
                        .blur(function () {
                            minimizeButton.removeClass('ui-state-focus');
                        })

                        .click(function (event) {
                            self.minimize(event);
                            return false;
                        })
                        .appendTo(self.uiDialogTitlebar),
            
			minimizeButtonText = (self.minimizeButtonText = $("<span>"))
                        .addClass("ui-icon ui-icon-minusthick")
                        .text("minimize").appendTo(minimizeButton);
                        
            /*Поведение элемента в taskbar на активацию формы*/
            this.element
                .bind("taskbardialogfocus", function (event) {
                    uiDialogTitlebar.addClass('ui-state-focus');
                    self.tile.addClass("ui-state-focus");
                    var active = self.taskbar.data("active_dialog");
                    if (active != self) {
                        if (active) active._trigger("blur", event);
                        self.taskbar.data("active_dialog", self);
                    }
                })
                .bind("taskbardialogblur", function () {
                    uiDialogTitlebar.removeClass('ui-state-focus');
                    self.tile.removeClass("ui-state-focus");
                });
            /*************************************************************************/

            /*Добавление элемента в taskbar*/
            if (this.options.taskbar) {
                var taskbar = (self.taskbar = $(this.options.taskbar))
                        .addClass("ui-taskbar"),
                tile = (self.tile = $("<div></div>"))
                        .addClass(
                            'ui-taskbar-tile-my ' +
                            'ui-widget-header ' +
                            'ui-corner-all ' +
                            'ui-helper-clearfix'
                        )
                        .text(this.options.title)
                        .appendTo(taskbar)
                        .click(function () {
                            self.unminimize();
                            self.moveToTop();
                        });
            } else {
                self.taskbar = $();
                self.tile = $();
            }            
        },
       

        _init: function () {
            $.ui.dialog.prototype._init.apply(this, arguments);
        },
        
        /*минимизация окна*/
        minimize: function (event) {
            this.uiDialog.hide();            
        },

        /*активация окна-восстановление*/
        unminimize: function (event) {           
                this.uiDialog.show();               
        },

        maximize: function (event) {

            var self = this,
            ui = self.uiDialog;
            var newHeight, newWidth;

            newHeight = $(window).height();
            newWidth = $(window).width();

            $(this).dialog("option", {
                "resizable": false,
                "draggable": false,
                "height": newHeight,
                "width": newWidth,
                "position": {
                    my: "left top",
                    at: "left top"
                }
            });

            self.uiDialog.show();
        },

        unmaximize: function (event) {
        },
        
        close: function (event) {
            if (this.tile) {
                this.tile.remove();
            }
            $.ui.dialog.prototype.close.apply(this, arguments);
        },

        destroy: function () {
            // remove classes + data
            $.Widget.prototype.destroy.call(this);
            return this;
        },
    });

})(jQuery);



Ни как не пойму почему окно не меняет размер в этой фукнции:
Код: javascript
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
maximize: function (event) {

            var self = this,
            ui = self.uiDialog;
            var newHeight, newWidth;

            newHeight = $(window).height();
            newWidth = $(window).width();

            $(this).dialog("option", {
                "resizable": false,
                "draggable": false,
                "height": newHeight,
                "width": newWidth,
                "position": {
                    my: "left top",
                    at: "left top"
                }
            });

            self.uiDialog.show();
        },


Прошу сильно не смеятся если заметили что-то не правильное...
c jQuery знаком 2 дня.

Спасибо!
...
Рейтинг: 0 / 0
jQuery dialog. windows system
    #38662317
Gustly
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
RomanH,

Не буду врать, но вот возможные варианты:

1) Смотри ошибки в консоли. Если они есть скрипт падает.
2) Через option можно менять только одну опцию. Сразу скажу сам не пробовал много.
То есть надо так
$( "#dialog-modal" ).dialog({
height: 140,
modal: true
});

Я бы начал в таком порядке.
http://api.jqueryui.com/dialog/
...
Рейтинг: 0 / 0
2 сообщений из 2, страница 1 из 1
Форумы / HTML, JavaScript, VBScript, CSS [игнор отключен] [закрыт для гостей] / jQuery dialog. windows system
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]