Rafael Wojcik Posted January 23, 2012 Report Share Posted January 23, 2012 Olá Pessoal! Alguém sabe como posso adaptar este código para definir a largura do menu em 100%? Atualmente está definido a largura de 984 px...Agradeço muito quem puder dar uma luz!uagent = window.navigator.userAgent.toLowerCase();IEB=(uagent.indexOf('msie') != -1)?true:false;var scompat = document.compatMode;var Slider1intcomplate=0;Slider1imgarr=new Array();Slider1altarr=new Array();Slider1linkarr=new Array();Slider1targetarr=new Array();Slider1titarr=new Array();Slider1desarr=new Array();Slider1imgarr[0]="";Slider1altarr[0]="";Slider1linkarr[0]="";Slider1targetarr[0]="";Slider1titarr[0]="";Slider1desarr[0]="";Slider1imgarr[1]="Img_slide_01.jpg";Slider1altarr[1]="";Slider1linkarr[1]="http://www.casadomontanhista.com.br";Slider1targetarr[1]="_self";Slider1titarr[1]="";Slider1desarr[1]="";Slider1imgarr[2]="Img_slide_02.jpg";Slider1altarr[2]="";Slider1linkarr[2]="http://www.casadomontanhista.com.br";Slider1targetarr[2]="_self";Slider1titarr[2]="";Slider1desarr[2]="";Slider1imgarr[3]="Img_slide_03.jpg";Slider1altarr[3]="";Slider1linkarr[3]="http://www.casadomontanhista.com.br";Slider1targetarr[3]="_self";Slider1titarr[3]="";Slider1desarr[3]="";Slider1imgarr[4]="Img_slide_04.jpg";Slider1altarr[4]="";Slider1linkarr[4]="http://www.casadomontanhista.com.br";Slider1targetarr[4]="_self";Slider1titarr[4]="";Slider1desarr[4]="";Slider1imgarr[5]="Img_slide_05.jpg";Slider1altarr[5]="";Slider1linkarr[5]="http://www.casadomontanhista.com.br";Slider1targetarr[5]="_self";Slider1titarr[5]="";Slider1desarr[5]="";var gnrated='';var Slider1stepcount=20;var Slider1currstep=10;var Slider1timeo=null;var Slider1horvert=0;var Slider1llllll=0;var Slider1lllllll=0;var Slider1llllllll=0;var Slider1ll=new Array();var Slider1lll=new Array();var Slider1llll=new Array();var Slider1startposx=new Array();var Slider1lllll=new Array();var i=0;var Slider1lllllllll=0;var Slider1DescCalcLeftBir=0;var Slider1DescCalcLeft=0;var Slider1DescCalcWidth=0;var Slider1DescCalcHeight=0;var Slider1DescCalcIcWidth=0;var Slider1DescCalcIcHeight=0;var Slider1hpiece='';var Slider1ds="";var Slider1IEDescOpacity=100;var Slider1FFOpacity=1.0;var Slider1DescFadeEffectTimer=null;var Slider1AutoPlayTimer=null;var Slider1AutoPlayCurrent=1;var Slider1icerdemi=0;function Slider1WriteDesc(){ if(Slider1linkarr[i].length>2){Slider1ds=Slider1ds+'<a href="'+Slider1linkarr[i]+'" target="'+Slider1targetarr[i]+'" style="text-decoration:none;">';} Slider1ds=Slider1ds+'<div id="Slider1adesc'+i+'" style="position:absolute;top:'+80+'px;left:0px;width:'+Slider1DescCalcWidth+'px;height:'+Slider1DescCalcHeight+'px;visibility:hidden;overflow:hidden;cursor:pointer;filter:alpha(opacity=100);opacity:1.00;" onMouseOut="Slider1outall()">'; Slider1ds=Slider1ds+'<div style="position:absolute;left:0px;top:0px;width:'+Slider1DescCalcWidth+'px;height:'+Slider1DescCalcHeight+'px;border-style:solid;border-width:0px;border-color:#000000;background-color:#'+'000000'+';opacity: '+0.50+';filter:alpha(opacity='+50+');" onMouseOut="Slider1outall()"></div>'; Slider1ds=Slider1ds+'<div style="position:relative;left:0px;top:0px;width:'+Slider1DescCalcIcWidth+';height:'+Slider1DescCalcIcHeight+'px;text-align:'+'left'+';overflow:hidden;padding:'+3+'px;border-style:'+'solid'+';border-width:'+2+'px;border-color:#'+'990000'+';color:#'+'FFFFFF'+';font-family:'+'arial'+';font-style:'+'normal'+';font-size: '+13+';font-weight:'+'normal'+';text-decoration:'+'none'+';opacity: 1.0;filter:alpha(opacity=100);" onMouseOut="Slider1outall()">'; Slider1ds=Slider1ds+'<span style="color:#'+'FECE3F'+';font-family:'+'arial'+';font-style:'+'normal'+';font-size: '+14+';font-weight:'+'normal'+';text-decoration:'+'none'+';" onMouseOut="Slider1outall()">'+Slider1titarr[i]+'</span>'; if(Slider1titarr[i].length>0){Slider1ds=Slider1ds+'<br />';} Slider1ds=Slider1ds+''+Slider1desarr[i]; Slider1ds=Slider1ds+'</div>'; Slider1ds=Slider1ds+'</div>'; if(Slider1linkarr[i].length>2){Slider1ds=Slider1ds+'</a>';}}function Slider1init_doc(fstr,hormuvertmi){ Slider1DescCalcLeftBir=5; if((0==0)&&(Slider1horvert==0)) { Slider1DescCalcLeft=5+2; } else { Slider1DescCalcLeft=5; } if(0==0) { Slider1DescCalcWidth=700-5-5; } else { Slider1DescCalcWidth=984-5-5; } if((Slider1horvert==1)&&(0==1)) { Slider1DescCalcHeight=300-80-5; } else { Slider1DescCalcHeight=300-80-5; } if((IEB==true)&&(scompat == "BackCompat" )) { Slider1DescCalcIcWidth=Slider1DescCalcWidth; Slider1DescCalcIcHeight=Slider1DescCalcHeight; } else { Slider1DescCalcIcWidth=Slider1DescCalcWidth-2*(2)-2*(3); Slider1DescCalcIcHeight=Slider1DescCalcHeight-2*(2)-2*(3); } Slider1folderset=fstr; var tmpleftpad=0; var tmptoppad=0; Slider1hpiece=Slider1hpiece+'<div style="position:relative;width:'+984+'px;height:'+300+'px;border-style:solid;border-width:'+0+'px;border-color:#'+'666666'+';">'; Slider1hpiece=Slider1hpiece+'<div style="position:relative;width:'+984+'px;height:'+300+'px;overflow:hidden;border-style:solid;border-width:0px;border-color:#FFFFFF;cursor:default;" onMouseOver="Slider1outall()" onMouseOut="Slider1mouse_divout()">'; if(0==1) { for(i=1;i<=5;i++) { Slider1WriteDesc(); } } for(i=1;i<=5;i++) { if(Slider1horvert==0) { if(i==1){tmpleftpad=0;}else{tmpleftpad=2;} tmptoppad=0; } else { tmpleftpad=0; if(i==1){tmptoppad=0;}else{tmptoppad=2;} } gnrated=gnrated+'<div id="Slider1po'+i+'" style="position:absolute;left:0px;top:0px;" onMouseOver="Slider1mouse_over('+i+')" onMouseOut="Slider1outall()"><div style="background-color:#FFFFFF;padding-left:'+tmpleftpad+'px;padding-top:'+tmptoppad+'px;"><a href="'+Slider1linkarr[i]+'" target="'+Slider1targetarr[i]+'"><img width="'+700+'" height="'+300+'" src="'+Slider1folderset+Slider1imgarr[i]+'" style="border-style:solid;border-width:0px;" TITLE="'+Slider1altarr[i]+'"></img></a>'; if(0==0) { Slider1ds=""; Slider1WriteDesc(); gnrated=gnrated+Slider1ds; } gnrated=gnrated+'</div></div>'; } Slider1hpiece=Slider1hpiece+gnrated; if(0==1) { Slider1hpiece=Slider1hpiece+Slider1ds; } Slider1hpiece=Slider1hpiece+'</div>'; Slider1hpiece=Slider1hpiece+'</div>'; document.write(''+Slider1hpiece); setTimeout("Slider1init_position("+parseInt(hormuvertmi)+")",50);}function Slider1init_position(hv){ Slider1horvert=hv; for(i=1;i<=5;i++) { Slider1ll[i]=document.getElementById('Slider1po'+i); Slider1lll[i]=document.getElementById('Slider1adesc'+i); if((Slider1ll[i]==null)||(Slider1lll[i]==null)) { setTimeout("Slider1init_position("+parseInt(hv)+")",200); return; } } if(Slider1horvert==0) { Slider1llllll=parseInt( (984-((5-1)*2)) /(5)); Slider1lllllll=Slider1llllll+2; Slider1llllllll=parseInt(((984-700)/(5-1))); } else { Slider1llllll=parseInt( (280-((5-1)*2)) /(5)); Slider1lllllll=Slider1llllll+2; Slider1llllllll=parseInt(((280-300)/(5-1))); } for(i=1;i<=5;i++) { Slider1ll[i]=document.getElementById('Slider1po'+i); sx=(Slider1lllllll*(i-1))-2; if(Slider1horvert==0) { if(i==1) { Slider1ll[i].style.left="0px"; } else { Slider1ll[i].style.left=""+sx+"px"; } } else { if(i==1) { Slider1ll[i].style.top="0px"; } else { Slider1ll[i].style.top=""+sx+"px"; } } Slider1startposx[i]=sx; Slider1lllll[i]=Slider1startposx[i]; if(i==1) { Slider1lll[i].style.left=""+Slider1DescCalcLeftBir+"px"; } else { Slider1lll[i].style.left=""+Slider1DescCalcLeft+"px"; } } Slider1intcomplate=1; if(1==1) { Slider1DoAutoPlay(); }}function Slider1DoAutoPlay(){ Slider1mouse_over(Slider1AutoPlayCurrent); Slider1AutoPlayCurrent=Slider1AutoPlayCurrent+1; if(Slider1AutoPlayCurrent>5) { Slider1AutoPlayCurrent=1; } Slider1AutoPlayTimer=setTimeout("Slider1DoAutoPlay()",4000);}function Slider1do_FadeAnim(){ if(Slider1lllllllll<1) { return; } Slider1IEDescOpacity=Slider1IEDescOpacity+5; Slider1FFOpacity=Slider1FFOpacity+0.05; if(IEB==true) { if(Slider1IEDescOpacity>100) { Slider1IEDescOpacity=100; return; } } else { if(Slider1FFOpacity>1.00) { Slider1FFOpacity=1.00; return; } } if(IEB==true) { Slider1lll[Slider1lllllllll].filters.item(0).opacity=Slider1IEDescOpacity; } else { Slider1lll[Slider1lllllllll].style.opacity = Slider1FFOpacity; } Slider1DescFadeEffectTimer=setTimeout("Slider1do_FadeAnim()",20);}function Slider1do_anim(){ if(Slider1currstep<=0) { if(Slider1lllllllll>=1) { if(Slider1horvert==0) { if(Slider1lllllllll==1) { Slider1lll[Slider1lllllllll].style.left=""+Slider1DescCalcLeftBir+"px"; } else { Slider1lll[Slider1lllllllll].style.left=""+Slider1DescCalcLeft+"px"; } } else { if(0==0) { Slider1lll[Slider1lllllllll].style.left=""+(Slider1DescCalcLeft+parseInt(Slider1ll[Slider1lllllllll].style.left))+"px"; var DesvertTop=0; if((Slider1lllllllll>1) &&(Slider1lllllllll!=5)){DesvertTop=80+2;}else{DesvertTop=80;} Slider1lll[Slider1lllllllll].style.top=""+(DesvertTop)+"px"; } else { Slider1lll[Slider1lllllllll].style.left=""+(Slider1DescCalcLeft)+"px"; Slider1lll[Slider1lllllllll].style.top=""+80+"px"; } } if((Slider1titarr[Slider1lllllllll].length>0)||(Slider1desarr[Slider1lllllllll].length>0)) { if(2==2) { Slider1IEDescOpacity=0; Slider1FFOpacity=0.00; Slider1do_FadeAnim(); Slider1lll[Slider1lllllllll].style.visibility="visible"; } else { Slider1lll[Slider1lllllllll].style.visibility="visible"; } } else { Slider1lll[Slider1lllllllll].style.visibility="hidden"; } } return; } for(i=2;i<=5;i++) { Slider1lllll[i] = parseInt(Slider1lllll[i])+parseInt((Slider1llll[i]-Slider1lllll[i])/Slider1currstep); if(Slider1horvert==0) { Slider1ll[i].style.left=""+Slider1lllll[i]+"px"; } else { Slider1ll[i].style.top=""+Slider1lllll[i]+"px"; } } if((2==1)&&(Slider1lllllllll>=1)) { var dtop=0; if((Slider1titarr[Slider1lllllllll].length>0)||(Slider1desarr[Slider1lllllllll].length>0)) { Slider1lll[Slider1lllllllll].style.visibility="visible"; } else { Slider1lll[Slider1lllllllll].style.visibility="hidden"; } dtop= 80+ parseInt(Slider1DescCalcHeight- ((Slider1DescCalcHeight/Slider1stepcount)*(Slider1stepcount-(Slider1currstep-1))) ); Slider1lll[Slider1lllllllll].style.top=""+dtop+"px"; } Slider1currstep--; setTimeout("Slider1do_anim()",20);}function Slider1reposition(g){ for(i=1;i<=5;i++) { if(i<=g) { if(i==1) { Slider1llll[i]=0; } else { Slider1llll[i]=parseInt(((i-1)*Slider1llllllll)-2); } } else { oncekix=0; for(j=1;j<(i-1);j++) { oncekix=oncekix+Slider1llllllll; } if(Slider1horvert==0) { Slider1llll[i]=parseInt(((700)+(oncekix))); } else { Slider1llll[i]=parseInt(((300)+(oncekix))); } } } if((Slider1horvert==0)&&(5==g)) { var bul1=Slider1llll[5]+2+700; var bul2=984-bul1; Slider1llll[5]=Slider1llll[5]+bul2; } if((Slider1horvert==1)&&(5==g)) { var bul1=Slider1llll[5]+2+300; var bul2=300-bul1; Slider1llll[5]=Slider1llll[5]+bul2; } Slider1currstep=Slider1stepcount; Slider1do_anim();}function Slider1mouse_over(g){ if(Slider1intcomplate==0){return;} if(g==Slider1lllllllll){return;} Slider1lllllllll=g; clearTimeout(Slider1timeo); if(1==1){if(Slider1icerdemi==1){clearTimeout(Slider1AutoPlayTimer);}} for(i=1;i<=5;i++) { if(i!=g) { Slider1lll[i].style.visibility="hidden"; if(IEB==true) { Slider1lll[i].filters.item(0).opacity=100; } else { Slider1lll[i].style.opacity = 1.0; } } } Slider1reposition(g);}function Slider1outall(){ Slider1icerdemi=1; clearTimeout(Slider1AutoPlayTimer); clearTimeout(Slider1timeo);}function Slider1mouse_divout2(){ Slider1icerdemi=0; clearTimeout(Slider1timeo); if(1==1) { clearTimeout(Slider1AutoPlayTimer); Slider1AutoPlayCurrent=1; Slider1DoAutoPlay(); } else { for(i=1;i<=5;i++) { Slider1lll[i].style.visibility="hidden"; } for(i=1;i<=5;i++) { sx=(Slider1lllllll*(i-1))-2; if(i==1) { Slider1llll[i]=0; } else { Slider1llll[i]=sx; } } Slider1lllllllll=-1; Slider1currstep=Slider1stepcount; Slider1do_anim(); }}function Slider1mouse_divout(){ clearTimeout(Slider1timeo); Slider1timeo=setTimeout("Slider1mouse_divout2()",300);} Quote Link to comment Share on other sites More sharing options...
0 Roger Mauricio Takemiya Posted January 24, 2012 Report Share Posted January 24, 2012 Bom diaUtilize, por exemplo, o notepad++, e busque por "984" ou por "984px", substituí por "100%", porém eu vi que é feito calculos com base no valor 984, então talvez, não seria interessante colocar 100%, e sim aumentar a quantidade de pixels ^_^ Quote Link to comment Share on other sites More sharing options...
0 Rafael Wojcik Posted January 26, 2012 Author Report Share Posted January 26, 2012 Olá Roger, obrigado pela resposta!Eu já tentei alterar onde ele define o tamanho em "px" por "%" mas acho que os cálculos não reconhecem o valor em porcentagem... Outra coisa... O maldito IE cria um espaço logo após o slide, o que não acontece no Chrome e Firefox, como é possível remover este espaço? Segue página para visualização: www.casadomontanhista.com.br/default2.aspValeu! Quote Link to comment Share on other sites More sharing options...
Question
Rafael Wojcik
Olá Pessoal! Alguém sabe como posso adaptar este código para definir a largura do menu em 100%? Atualmente está definido a largura de 984 px...
Agradeço muito quem puder dar uma luz!
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.