Ir para conteúdo
Fórum Script Brasil
  • 0

Pop It Menu->duvida


Guest tevez

Pergunta

pessoal ferinha

estou usando o codigo abaixo para configurar um pop menu. porém ao passar o mouse sobre o link, para que abram os sub-links, estes abrem exatamente na posicao do cursor, e não alinhados em um determinado ponto que eu escolha. isso acaba confundindo o usuario porque o menu fica meio q "balançando".. alguém sabe onde devo mexer para definir o local que eu quero que abra os sub-links?

o código (peguei em http://www.dynamicdrive.com/dynamicindex1/popit.htm):

<style type="text/css">

#popitmenu{
position:absolute;
background-color:#8FB3E6;
border:1px solid black;
font: normal 11px Arial;
line-height: 18px;
z-index: 100;
visibility: hidden;
}

#popitmenu a{
text-decoration: none;
padding-left:4px;
color: black;
display: block;
}

#popitmenu a:hover{ /*hover background color*/
background-color: #B1CDF4;
}

</style>
<script type="text/javascript">

/***********************************************
* Pop-it menu- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit [url=http://www.dynamicdrive.com/]http://www.dynamicdrive.com/[/url] for full source code
***********************************************/

var defaultMenuWidth="150px" //set default menu width.

var linkset=new Array()
//SPECIFY MENU SETS AND THEIR LINKS. FOLLOW SYNTAX LAID OUT

linkset[0]='<a href="welcome.htm" target="miolo">WELCOME</a>'
linkset[0]+='<hr size="1" noshade color="#99CCFF" width="165">' //Optional Separator
linkset[0]+='<a href="who_we_are.htm" target="miolo">Mission, Vision & Commitment</a>'
linkset[0]+='<a href="welcome.htm" target="miolo">Our Sponsor CCUSA</a>'
linkset[0]+='<a href="welcome.htm" target="miolo">The HR Department</a>'
linkset[0]+='<a href="welcome.htm" target="miolo">Contact</a>'
linkset[0]+='<a href="welcome.htm" target="miolo">FAQ</a>'

linkset[1]='<a href="who_we_are.htm" target="miolo">WHO WE ARE</a>'
linkset[1]+='<hr size="1" noshade color="#99CCFF" width="165">' //Optional Separator
linkset[1]+='<a href="who_we_are.htm" target="miolo">Program Overview</a>'
linkset[1]+='<a href="welcome.htm" target="miolo">The J1 Visa</a>'
linkset[1]+='<a href="welcome.htm" target="miolo">Our Sponsor CCUSA</a>'

linkset[2]='<a href="who_we_are.htm" target="miolo">BASIC SUPPORT INFO</a>'
linkset[2]+='<hr size="1" noshade color="#99CCFF" width="165">' //Optional Separator
linkset[2]+='<a href="who_we_are.htm" target="miolo">Legalities</a>'
linkset[2]+='<a href="welcome.htm" target="miolo">Contact</a>'

linkset[3]='<a href="who_we_are.htm" target="miolo">J1 VISA LEGALITIES</a>'
linkset[3]+='<hr size="1" noshade color="#99CCFF" width="165">' //Optional Separator
linkset[3]+='<a href="who_we_are.htm" target="miolo">Social Security Number</a>'
linkset[3]+='<a href="welcome.htm" target="miolo">The Docs. that prove he can legally work</a>'
linkset[3]+='<a href="welcome.htm" target="miolo">Hiring process</a>'
linkset[3]+='<a href="who_we_are.htm" target="miolo">How to fill a W4 Form</a>'
linkset[3]+='<a href="welcome.htm" target="miolo">Taxes</a>'
linkset[3]+='<a href="welcome.htm" target="miolo">Sponsor obligations</a>'
linkset[3]+='<a href="who_we_are.htm" target="miolo">Job Offer form</a>'
linkset[3]+='<a href="welcome.htm" target="miolo">Sevis</a>'
linkset[3]+='<a href="welcome.htm" target="miolo">FAQ</a>'

linkset[4]='<a href="who_we_are.htm" target="miolo">HIRE INTERNATIONALS</a>'
linkset[4]+='<hr size="1" noshade color="#99CCFF" width="165">' //Optional Separator
linkset[4]+='<a href="who_we_are.htm" target="miolo">The 4 basic steps to hire an international</a>'
linkset[4]+='<a href="welcome.htm" target="miolo">Our free HR services</a>'

linkset[5]='<a href="who_we_are.htm" target="miolo">OUR HR SERVICES</a>'
linkset[5]+='<hr size="1" noshade color="#99CCFF" width="165">' //Optional Separator
linkset[5]+='<a href="who_we_are.htm" target="miolo">Why are our HR services free</a>'
linkset[5]+='<a href="welcome.htm" target="miolo">Fill out an employer/job description form</a>'
linkset[5]+='<a href="welcome.htm" target="miolo">Job offer form</a>'
linkset[5]+='<a href="who_we_are.htm" target="miolo">Partner employers</a>'
linkset[5]+='<a href="welcome.htm" target="miolo">Why hire international staff</a>'
linkset[5]+='<a href="welcome.htm" target="miolo">Brazilians: The best staff</a>'
linkset[5]+='<a href="who_we_are.htm" target="miolo">Basic employer support info</a>'
linkset[5]+='<a href="welcome.htm" target="miolo">Legalities</a>'
linkset[5]+='<a href="welcome.htm" target="miolo">Our HR department</a>'
linkset[5]+='<a href="welcome.htm" target="miolo">How we recruit our students</a>'
linkset[5]+='<a href="welcome.htm" target="miolo">Interviewing tips</a>'
linkset[5]+='<a href="welcome.htm" target="miolo">Time difference: Brazil X EUA</a>'
linkset[5]+='<a href="welcome.htm" target="miolo">Job offer form</a>'

linkset[6]='<a href="who_we_are.htm" target="miolo">EMPLOYERS CHECK LIST</a>'
linkset[6]+='<hr size="1" noshade color="#99CCFF" width="165">' //Optional Separator
linkset[6]+='<a href="who_we_are.htm" target="miolo">Contact between student and employer</a>'
linkset[6]+='<a href="welcome.htm" target="miolo">Hiring procedures</a>'
linkset[6]+='<a href="who_we_are.htm" target="miolo">Social security office</a>'
linkset[6]+='<a href="welcome.htm" target="miolo">Travel / Arrival dates</a>'
linkset[6]+='<a href="who_we_are.htm" target="miolo">Paperwork and docs. for hiring</a>'
linkset[6]+='<a href="welcome.htm" target="miolo">Housing</a>'
linkset[6]+='<a href="who_we_are.htm" target="miolo">FAQ</a>'

linkset[7]='<a href="who_we_are.htm" target="miolo">FAQ</a>'
linkset[7]+='<hr size="1" noshade color="#99CCFF" width="165">' //Optional Separator
linkset[7]+='<a href="who_we_are.htm" target="miolo">J1 Visa</a>'
linkset[7]+='<a href="welcome.htm" target="miolo">Social Security</a>'
linkset[7]+='<a href="welcome.htm" target="miolo">Department of State</a>'
linkset[7]+='<a href="who_we_are.htm" target="miolo">Legal Issues</a>'
linkset[7]+='<a href="welcome.htm" target="miolo">How to contact them</a>'
linkset[7]+='<a href="welcome.htm" target="miolo">Why are our services free</a>'
linkset[7]+='<a href="who_we_are.htm" target="miolo">CCUSA</a>'
linkset[7]+='<a href="welcome.htm" target="miolo">Sponsor Obligations</a>'
linkset[7]+='<a href="welcome.htm" target="miolo">Our HR department</a>'
linkset[7]+='<a href="welcome.htm" target="miolo">Wages</a>'
linkset[7]+='<a href="welcome.htm" target="miolo">Tax Witholding</a>'


////No need to edit beyond here

var ie5=document.all && !window.opera
var ns6=document.getElementById

if (ie5||ns6)
document.write('<div id="popitmenu" onMouseover="clearhidemenu();" onMouseout="dynamichide(event)"></div>')

function iecompattest(){
return (document.compatMode && document.compatMode.indexOf("CSS")!=-1)? document.documentElement : document.body
}

function showmenu(e, which, optWidth){
if (!document.all&&!document.getElementById)
return
clearhidemenu()
menuobj=ie5? document.all.popitmenu : document.getElementById("popitmenu")
menuobj.innerHTML=which
menuobj.style.width=(typeof optWidth!="undefined")? optWidth : defaultMenuWidth
menuobj.contentwidth=menuobj.offsetWidth
menuobj.contentheight=menuobj.offsetHeight
eventX=ie5? event.clientX : e.clientX
eventY=ie5? event.clientY : e.clientY
//Find out how close the mouse is to the corner of the window
var rightedge=ie5? iecompattest().clientWidth-eventX : window.innerWidth-eventX
var bottomedge=ie5? iecompattest().clientHeight-eventY : window.innerHeight-eventY
//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<menuobj.contentwidth)
//move the horizontal position of the menu to the left by it's width
menuobj.style.left=ie5? iecompattest().scrollLeft+eventX-menuobj.contentwidth+"px" : window.pageXOffset+eventX-menuobj.contentwidth+"px"
else
//position the horizontal position of the menu where the mouse was clicked
menuobj.style.left=ie5? iecompattest().scrollLeft+eventX+"px" : window.pageXOffset+eventX+"px"
//same concept with the vertical position
if (bottomedge<menuobj.contentheight)
menuobj.style.top=ie5? iecompattest().scrollTop+eventY-menuobj.contentheight+"px" : window.pageYOffset+eventY-menuobj.contentheight+"px"
else
menuobj.style.top=ie5? iecompattest().scrollTop+event.clientY+"px" : window.pageYOffset+eventY+"px"
menuobj.style.visibility="visible"
return false
}

function contains_ns6(a, B) {
//Determines if 1 element in contained in another- by Brainjar.com
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function hidemenu(){
if (window.menuobj)
menuobj.style.visibility="hidden"
}

function dynamichide(e){
if (ie5&&!menuobj.contains(e.toElement))
hidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
hidemenu()
}

function delayhidemenu(){
delayhide=setTimeout("hidemenu()",500)
}

function clearhidemenu(){
if (window.delayhide)
clearTimeout(delayhide)
}

if (ie5||ns6)
document.onclick=hidemenu

</script>

Link para o comentário
Compartilhar em outros sites

1 resposta a esta questão

Posts Recomendados

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,3k
    • Posts
      652,2k
×
×
  • Criar Novo...