Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / HTML, JavaScript, VBScript, CSS [игнор отключен] [закрыт для гостей] / Конфликт js-меню и js-слайд-шоу / 1 сообщений из 1, страница 1 из 1
25.08.2009, 17:30
    #36162365
sotny
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Конфликт js-меню и js-слайд-шоу
Здравствуйте! У меня возникла проблема: на сайте есть js-код, который отвечает за генерацию слайд-шоу (показ картинок). Мне нужно было разработать меню. Разработала, начала его встраивать, получила следующее:
1. Если работает меню, то не работает слайд-шоу.
2. Либо работает слайд-шоу, а меню вообще не отображается.
Нашла строчку кода, если она есть, то случай 1. Если её убираю – случай 2.
Подскажите, как от этого избавиться?
Js-код, отвечающий за слайд-шоу:
Код: plaintext
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.
function changeImages() {
	if (document.images) {
		for (var i= 0 ; i < changeImages.arguments.length; i+= 2 ) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+ 1 ];
		}
	}
}
function findDOM(objectID)
{
	if(document.getElementById)
	{
		//alert("Get by ID");
		return (document.getElementById(objectID));
	}
	else if(document.all)
	{
		//alert("Get by ALL");
		return (document.all[objectID]);
	}
	else if((navigator.appName.indexOf('Netscepe') != - 1 ) && (parseInt(navigator.appVersion) ==  4  ))
	{
		//alert("Get by Layers");
		return (document.layers[objectID]);
	}
}
function tdUpdateBg( id, color ) 
{
	var object = document.getElementById( id );
	object.style.backgroundColor = color; 
}
// Set slideShowSpeed (milliseconds)
var slideShowSpeed =  9000 ;
// Duration of crossfade (seconds)
var crossFadeDuration =  1 ;
// Specify the image files

// to add more images, just continue
// the pattern, adding to the array below

// do not edit anything below this line
var t;
var j =  0 ;
var p = Pic.length;
var preLoad = new Array();
for (i =  0 ; i < p; i++) {
    preLoad[i] = Pic[i];
}

//  End -->
function runSlideShow1() {
    if( j !=  0  )
    {
        if (document.all) {
            findDOM('TdStyle').style.filter="blendTrans(duration=2)";
            findDOM('TdStyle').style.filter="blendTrans(duration=crossFadeDuration)";
            findDOM('TdStyle').filters.blendTrans.Apply();
        }
    }
    if( p >  1  )
        findDOM('TdStyle').style.backgroundImage = Pic[j];

    if( j !=  0  )
    {
        if (document.all) {
            findDOM('TdStyle').filters.blendTrans.Play();
        }
    }
    j = j +  1 ;
    if (j > (p -  1 )) j =  0 ;
    t = setTimeout('runSlideShow1()', slideShowSpeed);
}
Js-код, отвечающий за генерацию меню:
Код: plaintext
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.
function lib_bwcheck(){ //Browsercheck (needed)
	[color=red]this.ver=navigator.appVersion – вот эта злощасная строка[/color]
	this.agent=navigator.userAgent
	this.dom=document.getElementById? 1 : 0 
	this.opera5=this.agent.indexOf("Opera 5")>- 1 
	this.ie5=(this.ver.indexOf("MSIE 5")>- 1  && this.dom && !this.opera5)? 1 : 0 ; 
	this.ie6=(this.ver.indexOf("MSIE 6")>- 1  && this.dom && !this.opera5)? 1 : 0 ;
	this.ie4=(document.all && !this.dom && !this.opera5)? 1 : 0 ;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>- 1 
	this.ns6=(this.dom && parseInt(this.ver) >=  5 ) ? 1 : 0 ; 
	this.ns4=(document.layers && !this.dom)? 1 : 0 ;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}
var bw=new lib_bwcheck()



/*** variables you can configure ***/

FoldNumber =  9 					//How many toplinks do you have?
var stayFolded = false			//Stay open when you click a new toplink?
foldImg =  1 						//Do you want images (if not set to  0  and remove the images from the body)?
mainOffsetY =  0 				//Vertical space adjustment between the main items, in pixels.

//This is the default image.
//Remember to change the actual images in the page as well, but remember to keep the name of the image.
var unImg=new Image();
unImg.src='<?= $stylesheet_dir ?>/images/menus/main/buttons/but_vertical.gif'

var exImg=new Image();					//Making an image variable...
exImg.src='<?= $stylesheet_dir ?>/images/menus/main/buttons/but_gorisontal.gif'		//...this is the source of the image that it changes to when the menu expands.

// NOTE: if you change the position of divCont from absolute to relative, you can put the foldoutmenu in a table.
// HOWEVER it will no longer work in netscape  4 . If you wish to support netscape  4 , you have to use absolute positioning.

/*** There should be no need to change anything beyond this. ***/

// A unit of measure that will be added when setting the position of a layer.
var px = bw.ns4||window.opera?"":"px";

if(navigator.userAgent.indexOf('Opera')>- 1  && document.getElementById){ //Opera  5  resize fix.
	scrX= innerWidth; scrY= innerHeight;
	document.onmousemove= function(){
		if(scrX<innerWidth- 10  || scrY<innerHeight- 10  || scrX>innerWidth+ 10  || scrY>innerHeight+ 10 ){
			scrX = innerWidth;
			scrY = innerHeight;
			initFoldout();
		}
	};
}

//object constructor...
function makeMenu(obj,nest){
	nest= (!nest)?"":'document.'+nest+'.';
	this.el= bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):document.getElementById(obj);	
   	this.css= bw.ns4?this.el:this.el.style;
	this.ref= bw.ns4?this.el.document:document;		
	this.x= (bw.ns4||bw.opera5)?this.css.left:this.el.offsetLeft;
	this.y= (bw.ns4||bw.opera5)?this.css.top:this.el.offsetTop;
	this.h= (bw.ie||bw.ns6)?this.el.offsetHeight:bw.ns4?this.ref.height:bw.opera5?this.css.pixelHeight: 0 ;
    this.vis= b_vis;
	this.hideIt= b_hideIt;
    this.showIt= b_showIt;
    this.moveIt= b_moveIt;
	return this
}
//object methods...
function b_showIt(){this.css.visibility='visible'}
function b_hideIt(){this.css.visibility='hidden'}
function b_vis(){if(this.css.visibility=='hidden' || this.css.visibility=='HIDDEN' || this.css.visibility=='hide') return true;}
function b_moveIt(x,y){this.x=x; this.y=y; this.css.left=this.x+px; this.css.top=this.y+px}

/************************************************************************************
This is the function that changes the sub menus to folded or unfolded state.
************************************************************************************/
function menu(num){
	if(bw.bw){
		if (!stayFolded){
			for (var i= 0 ; i<oSub.length; i++){
				if (i!=num){
					oSub[i].hideIt()
					if (foldImg)oTop[i].ref["imgA"+i].src = unImg.src
				}
			}
			for(var i= 1 ; i<oTop.length; i++){
				oTop[i].moveIt( 0 ,oTop[i- 1 ].y+oTop[i- 1 ].h)
			}
		}
		if (oSub[num].vis()){
			oSub[num].showIt()
			if (foldImg)oTop[num].ref["imgA"+num].src = exImg.src
		}else{
			oSub[num].hideIt()
			if(foldImg)oTop[num].ref["imgA"+num].src = unImg.src
		}
		for(var i= 1 ; i<oTop.length; i++){ 
			if (!oSub[i- 1 ].vis()) oTop[i].moveIt( 0 ,oTop[i- 1 ].y+oTop[i- 1 ].h+oSub[i- 1 ].h+mainOffsetY) 
			else oTop[i].moveIt( 0 ,oTop[i- 1 ].y+oTop[i- 1 ].h+mainOffsetY)
		}
	}
}

/*********************************************************************
The init function... there should be no need to change anything here.
*********************************************************************/
function initFoldout(){
	//Fixing the browsercheck for opera... this can be removed if the browsercheck has been updated!!
	bw.opera5 = (navigator.userAgent.indexOf("Opera")>- 1  && document.getElementById)?true:false
	if (bw.opera5) bw.ns6 =  0 

	oTop = new Array()
	oSub = new Array()
	//Making the objects and hiding the subs...
	for (var i= 0 ; i<FoldNumber; i++){
		oTop[i] = new makeMenu('divTop'+i,'divCont')
		oSub[i] = new makeMenu('divSub'+i,'divCont.document.divTop'+i)
		oSub[i].hideIt()
	}
	
	//Positioning the top objects...
	oTop[ 0 ].moveIt( 0 , 0 )
	for (var i= 1 ; i<oTop.length; i++){
		oTop[i].moveIt( 0 , oTop[i- 1 ].y+oTop[i- 1 ].h+mainOffsetY)
	}
	
	//Making the containing menu object and showing it...
	oCont = new makeMenu('divCont')
	oCont.showIt()
}

// If the browser is ok, the script is started onload...
if(bw.bw) onload = initFoldout;
...
Рейтинг: 0 / 0
Форумы / HTML, JavaScript, VBScript, CSS [игнор отключен] [закрыт для гостей] / Конфликт js-меню и js-слайд-шоу / 1 сообщений из 1, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


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