Click here to Skip to main content
16,013,516 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how can i set multiple links on a navigation button if i take cursor on it multiple link associated with it will be shown like in this web site when i take my cursor on articles multiple links are shown

when i take my cursor on quick answers it shows me ask a qn/view unanswerd qn/view all qn/...
Posted

 
Share this answer
 
Comments
Member 11507028 27-May-15 12:31pm    
thankyou
This would not be the "multiple links on the navigation button". In a way, it will be zero links.

I'll explain. What you describe is the pretty complex behavior where at least two control elements are involved: a button plus something else. The second element could be the select element. Or it could be HTML5 datalist. It is kept invisible and is shown only on certain events.

There are no links on the button element at all. You populate the select or data list element with those links and retrieve then on the button click.

This is just some pseudo-code:
JavaScript
var buttonElement = //...
var selectElement = //...
var inButtonElement = false;
var inSelectElement = false;

//...
buttonElement.onclick = function() {
   // get selected choice element from selectElement
   // extract link from the selected choice element
   // using the link, navigate, or something else
   // if you stay on the same page, hide selectElement
}

buttonElement.onmouseover = function() {
   // show selectElement
   inButtonElement = true;
}
buttonElement.onmouseout = function() {
   inButtonElement = false;
   if (! (inButtonElement | inSelectElement))
       // hide selectElement
}
selectElement.onmouseover = function() {
   inSelectElement = true;
}
selectElement.onmouseout = function() {
   inSelectElement = false;
   if (! (inButtonElement | inSelectElement))
       // hide selectElement
}
Are you getting the idea?

One good way to implement it all easily is jQuery. If you need to learn jQuery (highly recommended), please see:
http://en.wikipedia.org/wiki/JQuery,
http://jquery.com,
http://learn.jquery.com,
http://learn.jquery.com/using-jquery-core,
http://learn.jquery.com/about-jquery/how-jquery-works (start from here).

—SA
 
Share this answer
 
v2
Comments
Member 11507028 27-May-15 12:31pm    
thank you
Sergey Alexandrovich Kryukov 27-May-15 12:39pm    
You are very welcome. Good luck, call again.
—SA
Sergey Alexandrovich Kryukov 27-May-15 12:43pm    
I just updated the answer a bit. See the words "datalist" and "data list".
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900