powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Java [игнор отключен] [закрыт для гостей] / Доработка Java всплывающие окна
5 сообщений из 5, страница 1 из 1
Доработка Java всплывающие окна
    #38399474
denees
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Имеется скрипт всплывающего меню. Блоки в нем всплывают с эффектом Fx.Tween. При открытии третьего всплвающего блока (меню->подменю->под-подменю), блок "проявляется" слева направо. А надо, что б в другом порядке. Собственно, вот сайт, над которым ведется работ: www.rulonnie-shtori.ru (в пункте ткани есть подпункты). Весь скрипт перелопатил, уже понимать стал что-то в яве, но так и не достиг желаемого эффекта. Прошу помощи. Собственно, вот сам скрипт:
Код: java
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.
191.
192.
193.
194.
/* OT Document JAVASCRIPT for MENU DROPDOWN */
if (typeof(MooTools) != 'undefined') {
	var subnav = new Array();
	
	Element.implement(
	{
		hide: function(timeout)
		{
			this.status = 'hide';
			clearTimeout(this.timeout);
			if (timeout) {
				this.timeout = setTimeout(this.anim.bind(this), timeout);
			} else {
				this.anim();
			}
		},
		
		show: function(timeout)
		{
			this.status = 'show';
			clearTimeout(this.timeout);
			if (timeout) {
				this.timeout = setTimeout(this.anim.bind(this), timeout);
			} else {
				this.anim();
			}
		},
		
		set_Active: function()
		{
			this.className += ' sfhover';
		},
		
		setDeactive: function() {
			this.className = this.className.replace(new RegExp(' sfhover\\b'), '');
		},
		
		anim: function()
		{
			if ((this.status == 'hide' && this.style.left != 'auto') || (this.status == 'show' && this.style.left == 'auto' && !this.hidding)) return;
			this.setStyle('overflow', 'hidden');
			if (this.status == 'show') {
				this.hidding = 0;
				this.hideAll();
			}
			
			if (this.status == 'hide') {
				this.hidding = 1;
				this.myFx2.cancel();
				if (this.parent._id) {
					this.myFx2.start('width', this.offsetWidth, 0);
				} else {
					this.myFx2.start('height', this.offsetHeight, 0);
				}
			} else {
				this.setStyle('left', 'auto');
				this.myFx2.cancel();
				if (this.parent._id) this.myFx2.start('width', 0, '205px');
					else this.myFx2.start('height', 0, this.mh);
			}
		},
		init: function()
		{
			this.mw = this.clientWidth;
		   	this.mh = this.clientHeight;
			if (this.parent._id) {
				this.myFx2 = new Fx.Tween(this, {			
                                        duration: 400,
					link: 'cancel'
				});
				this.myFx2.set('width',0);
			} else {
				this.myFx2 = new Fx.Tween(this, {
					duration: 400,
					link: 'cancel'
				});
				this.myFx2.set('height',0);
			}
			
			this.setStyle('left', '-999em');
			
			animComp = function()
			{
				if (this.status == 'hide') {
					this.setStyle('left', '-999em');
					this.hidding = 0;
				}
				
				this.setStyle('overflow', '');
			}
			this.myFx2.addEvent('onComplete', animComp.bind(this));
		},
		
		hideAll: function()
		{
			for (var i = 0; i < subnav.length; i++) {
				if (!this.isChild(subnav[i])) {
					subnav[i].hide(0);
				}
			}
		},
		
		isChild: function(_obj)
		{
			obj = this;
			while (obj.parent) {
				if (obj._id == _obj._id) {
					return true;
				}
				obj = obj.parent;
			}
			return false;
		}
	});
	
	var DropdownMenu = new Class({
		
		initialize: function(element)
		{
			if(element.className == 'menu_round')
			{
				$A($(element).childNodes).each(function(el){
					if(el.className == 'menu_mid'){
						$A($(el).childNodes).each(function(el_1){
							if(el_1.nodeName.toLowerCase() == 'ul'){
								elm = $(el_1);
							}
						});
					}
				});
			}
			else
			{
				elm = $(element);
			}
			$A($(elm).childNodes).each(function(el_2){
				if (el_2.nodeName.toLowerCase() == 'li') {
					$A($(el_2).childNodes).each(function(el_3) {
						if (el_3.className == 'menu_round') {
							$(el_3)._id = subnav.length + 1;
							$(el_3).parent = $(element);
							subnav.push($(el_3));
							el_3.init();
							
							el_2.addEvent('mouseenter', function() {
								el_2.set_Active();
								el_3.show(0);
								return false;
								
							});
							
							el_2.addEvent('mouseleave', function() {
								el_2.setDeactive();
								el_3.hide(20);
							});
							
							new DropdownMenu(el_3);
							el_2.hasSub = 1;
						}
					});
					if (!el_2.hasSub) {
						el_2.addEvent('mouseenter', function() {
							el_2.set_Active();
							return false;
						});
						
						el_2.addEvent('mouseleave', function() {
							el_2.setDeactive();
						});
					}
				}
			});
			return this;
		}
	});
		window.addEvent('domready', function() {
			new DropdownMenu(document.getElement('#ot-mainmenu ul.level0'));
		});
} else {
	sfHover = function()
	{
		var sfEls = document.getElementById("ot-mainmenu").getElementsByTagName("li");
		for (var i = 0; i<sfEls.length; ++i) {
			sfEls[i].onmouseover = function() {
				this.className += " sfhover";
			}
			sfEls[i].onmouseout = function() {
				this.className = this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
	if (window.attachEvent) window.attachEvent("onload", sfHover);
}
/* +++++++++++++++ End +++++++++++++++++++ */
...
Рейтинг: 0 / 0
Доработка Java всплывающие окна
    #38399778
denees
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Пока тишина, наведу немного конкретики.

Есть блок скрипта, отвечающий за анимацию при раскрытии/сворачивании меню. Он приведен ниже.
Есть там строчка, в которой описывается параметр раскрытия меню "if (this.parent._id) this.myFx2.start('width', 0, '205px');", в которой заданы значения в какой плоскости происходят изменения, стартовая и конечная позиции. "Жонглирование" аргументами ни к чему не привело. Копался в учебниках MooTools, новых надстроек не нашел. Возник вопрос, а оно есть? Или надо скрипт в корне менять?


Шарился в настройках MooTools, g

Код: 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.
		anim: function()
		{
			if ((this.status == 'hide' && this.style.left != 'auto') || (this.status == 'show' && this.style.left == 'auto' && !this.hidding)) return;
			this.setStyle('overflow', 'hidden');
			if (this.status == 'show') {
				this.hidding = 0;
				this.hideAll();
			}
			
			if (this.status == 'hide') {
				this.hidding = 1;
				this.myFx2.cancel();
				if (this.parent._id) {
					this.myFx2.start('width', this.offsetWidth, 0);
				} else {
					this.myFx2.start('height', this.offsetHeight, 0);
				}
			} else {
				this.setStyle('left', 'auto');
				this.myFx2.cancel();
				if (this.parent._id) this.myFx2.start('width', 0, '205px');
					else this.myFx2.start('height', 0, this.mh);
			}
		},
		init: function()
		{
			this.mw = this.clientWidth;
		   	this.mh = this.clientHeight;
			if (this.parent._id) {
				this.myFx2 = new Fx.Tween(this, {			
                                        duration: 400,
					link: 'cancel'
				});
				this.myFx2.set('width',0);
			} else {
				this.myFx2 = new Fx.Tween(this, {
					duration: 400,
					link: 'cancel'
				});
...
Рейтинг: 0 / 0
Доработка Java всплывающие окна
    #38399823
Фотография Petro123
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
denees,
тебе в форум JS.
- сайт ещё сырой что ли? Очень слабый дизайн и твоё меню не работает на тачскринах мобильных.
Там MouseMove нету, поэтому раскрывать надо на клик мышкой. У тебя меню идёт на перезагрузу страницы.
...
Рейтинг: 0 / 0
Доработка Java всплывающие окна
    #38399936
denees
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
спасибо за ценный комент. буду менять модуль меню либо шаблон (это конструктор joomla). сайт в разработке.
...
Рейтинг: 0 / 0
Доработка Java всплывающие окна
    #38399963
Фотография Petro123
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
deneesjoomla
OFF
на форуме JS пинали сам данный движок.
Удачи!
...
Рейтинг: 0 / 0
5 сообщений из 5, страница 1 из 1
Форумы / Java [игнор отключен] [закрыт для гостей] / Доработка Java всплывающие окна
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


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