Menu Hide When Clicked Outside?
Oct 12, 2010
I would like to have a multiple onclick show/hide menu system with javascript. And theres one more thing I need is to hide my menu when someone clicks outside it.
So basically I have a hidden div layer and a link. And when someone clicks on it I want the hidden div layer to show. And on a second click I want it to be hidden again. But if the menu is displayed and someone clicks outside it then hide it again.
If that makes sens now I really would like to have a anwser on this I have searched on the internet like 20 times already and all those code sucks.
I do not want any body onclick examples and I don't want to use JQuery.
This is the code I have so far I hope someone could give me example with my code intergrated into it
HTML Code:
<a href="javascript:void(0);" onclick="NCG_toggle('option');">Panel</a>
<div id="option" style="display:none;">
<a href="">my test</a>
[Code]....
View 4 Replies
ADVERTISEMENT
Sep 30, 2010
I am trying to create a specific menu using jQuery where i want to toggle a clicked menu item. I used toggleClass to accomplish this. All fine and well, but what i want is that once i click a menu item, the previously clicked item should have the active state/class toggled off.. The menu is variable. (I tried and tried and searched all over the internet, but i cannot find it... spent 5 hours trying to combine various selectors and if/else statements, but it did'nt work.)
View 1 Replies
View Related
Oct 26, 2009
The purpose of the code is to slideToggle open one of two hidden sub-nav bars when either of two different menu items are clicked upon - instead of a drop down menu. What doesn't work is the hiding of the div that is not required, if it is already open. Viewing in firebug shows that the appropriate classes are being applied - I suspect the reason is that slideToggle has been somehow set and cannot be unset via another object - but perhaps that is not it at all?
$(document).ready(function() {
//add .toggle function to appropriate li element
$('#hozmenu li:nth-child(4)').toggle(function () {
//set 4th menu links colour to be green whilst div is shown
$('#hozmenu li:nth-child(4) a').css('color', '#95d890');
$('#toggle_nav_services').removeClass('toggle_show');
[Code]....
View 1 Replies
View Related
Dec 12, 2011
I'm trying to make this menu go up and down when the arrows are clicked. Right now, it shows all of them and I can't figure out how to make it so that it only shows the first 9 and will show the rest in the menu when it's clicked. I really don't know where to start. I found some scripts but they turned out really funky. Even if it's something super simple is cool, just where to begin??
[Code]...
View 2 Replies
View Related
Apr 26, 2010
To build a menu block which should be switchable with hide/unhide of the menu items, I'm using .append html. The code idea is this:
[Code]...
As can be seen from above posted code there is a line "<div id="' + menuSlider + '" style="display:none">". Appending that -- AFAIS -- the .append is automatically (????) adding "</div>" which closes the statement. That breaks my idea of the whole concept! The menu part isn't included in the 'menuSlider '. QQ: How to change it -- NOT to have that "</div" added to it??
View 2 Replies
View Related
Feb 24, 2009
Is there a way in which I can make a div go to display:none when you click outside it? Here's what I've already got:
<script language="javascript" type="text/javascript">
function displayDiv()
{
var dv = document.getElementById("test");
[code]....
View 3 Replies
View Related
Oct 23, 2011
I'm trying to create a list of questions and answers, with the questions hidden on page load. They get hidden by this Javascript (to avoid breaking the site for those without JS):
Code:
function init() {
var dds = document.getElementById("qanda").getElementsByTagName("dd");
for (var ddid=0; ddid<dds.length; ddid++){
[Code]....
how I can go about displaying the <dd> tags again? I've tried Google, but not being familiar with Javascript terminology, haven't got very far!
View 4 Replies
View Related
Dec 27, 2010
How can i hide a button when i click it?
View 10 Replies
View Related
Jul 17, 2010
I dont know how to display a HTML form when user click on a radio button. I have two forms in a page, when user click on a radio button that correspond to its form, the other form will be hidden. I have the idea to use if...else statement. But I dont know what code to be inserted in an onClick event. I also not sure whether this is logic or not, whether this can be done or not.
[Code]...
View 2 Replies
View Related
May 24, 2010
I have put the following code into a sharepoint aspx page. So that when I change the value in a drop down box it runs a function (in this case it displays "Works").
<script language="javascript" type="text/javascript">
function getField(fieldType,fieldTitle) {
var docTags = document.getElementsByTagName(fieldType);
for (var i=0; i < docTags.length; i++) {
if (docTags[i].title == fieldTitle) {
return docTags[i]
}}}
function TestFunctionName() {
alert("Works");
}
getField('Select','DropDownBoxName').onchange = function() {TestFunctionName()};
</script>
What I'd like to be able to do as well is when a check box is changed or clicked on the same thing happens. I dont seem to be able to achieve it though. I've change the line...
getField('Select','DropDownBoxName').onchange = function() {TestFunctionName()};
to...
getField('Input','CheckBoxName').onchange = function() {TestFunctionName()};
and
getField('Input','CheckBoxName').onclick = function() {TestFunctionName()};
View 3 Replies
View Related
Feb 15, 2012
In my web site I have a jquery tab. When clicked a tab I want to show a div which writes loading [ <div class="loading"><p>Loading...</p></div> ] and hide it when the clicked tab content is shown. Is there a way to do this?
My code is below.
<script>
$(function() {
var $tabs = $('#tabs').tabs();
[code]....
View 1 Replies
View Related
Dec 31, 2009
HTML Code:
<ul id="toggle">
<li class="previous"><a href="#1"><</li>
<li class="next"><a href="#2">></a></li>
</ul>
Basically what I'm looking to do is at first, I want to hide the previous link until next is clicked. When next is clicked the first href will change to #2 and the 2nd will change to #3. If then #2 is clicked it'll go back to the first step, if #3 is clicked it'll move on to...
#2 changes to #3 and #3 changes to #4, repeat above process.
#3 changes to #4 and #4 from the last frame is now hidden.
Is this possible with javascript?
View 1 Replies
View Related
Oct 29, 2011
1. I have code to show tip like:
<a class="notvisible" onclick="mytip.disable();" href="javascript:void(0);">Close</a>
How is correct Javascript code to Close this tip when clicked?
2. How to move next news feed with click on arror icon and back icon?
<a onclick="mynews.previous();" href="javascript:void(0);">Previous</a> <a onclick="mynews.next();" href="javascript:void(0);">Next</a>
How is correct Javascript code to move news item next and prevoius news? when clicked?
PHP Code:
<script type="text/javascript">
mynews.init();
mytip.init();
</script>
View 2 Replies
View Related
Aug 22, 2011
i m trying to make a simple nested menu. my problem is when i click on child li's the parent as well as whole menu toggle to hide. i added a class too but its not helping.
Code HTML4Strict:
<script>
$("ul.xoxo>li").slideToggle("slow")[code].....
View 5 Replies
View Related
May 8, 2010
Like if I make a dropdown menu using javascript, how do I make it go away whenever you click outside of it?
View 5 Replies
View Related
Sep 24, 2010
I am currently looking to create a JavaScript menu for a website I am working on. It currently expands and collapses on click. The code in question is pasted below:-
menu_status = new Array();
function showHide(theid){
if (document.getElementById) {
var switch_id = document.getElementById(theid);
[Code]....
As you can see, it basically shows and hides the menu (when clicked). I want it to open the menu when clicked and close when another menu is opened. I have looked and have not been able to find a solution into it. Ideally I donot want it to be a long piece of code as I do have a working menu but with many more lines of JavaScript than the one I have posted.
View 6 Replies
View Related
May 23, 2011
I need to show/hide certains divs when a link is clicked.These are my divs:
div1
div2
div3
div4
div5
I will have several links. Depending on which link is clicked it will hide/show several divs simultaneously For example, if link1 is clicked it will hide div1, div2 and div3 and show div4 and div5.
View 10 Replies
View Related
Jan 27, 2010
I have a vertical menu consisting of CSS rollovers. When clicked, each one dynamically loads a new Flash movie via Javascript, within the same page. This works fine. However, what I would really like, is to have each menu item highlighted after it has been clicked, to show the user what is being shown. This could be the same image as is displayed in the active CSS state. Does anyone know how I can do this? Because each link is simply dynamically loading flash movies, and not going to a new html page, I can't simply add an ID element.
CSS:
#navlist {
font-family:Arial, Helvetica, sans-serif;
font-size:.8em;
font-weight:bold;
list-style:none;
}
#navlist a {
display:block;
[Code]....
View 15 Replies
View Related
Dec 16, 2011
I have working code to Show/Hide content when clicked on link of particular section:
var showText="Show content FAQ1";
var hideText="Hide content FAQ1";
1. How to do link on particular Title and show this description like Description1, Description2 etc.
2. How to open some sections in advance inside Javascript?
Working code is the following using Jquery jqueryV1.4.4:
PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">[code]....
View 1 Replies
View Related
Feb 4, 2010
I'm trying to create a horizontal dropline menu out of an unordered list. List items can have one unordered list child. I want to add a click event on all li:has(ul) elements. The pseudo-algorithm I'm thinking of is as follows:Find all other li:has(ul) elements on the page.For each, check if they are displayed.If displayed, hide it.Then, if the clicked li is displayed, hide it. Otherwise display it.Only one li:has(ul) element should be displayed at a time.
<script type="text/javascript">
$(function(){
$('li:has(ul)').click(function(event)
[code]....
What I have doesn't work because in the .each() function, the clicked li is also evaluated. So, if the clicked li is already visible, it gets toggled inside that function and then toggled again outside that function.
View 1 Replies
View Related
Oct 6, 2010
I have been using the Sitepoint book jQuery from Novice to Ninja. I'm still very much a novice but I'm making some progress...I have a jQuery accordion effect set-up on a a nested list. The effect is working great, however, I want to retain the menu state (e.g. which section is open) when a user clicks a particular link and the site loads a new page. I'm thinking I must need to use a cookie or similar but have no idea how to implement this. Here is the jQuery I have currently:
Code JavaScript:
$(document).ready(function(){
$('.boxCategories ul > li ul')
[code]....
View 1 Replies
View Related
Mar 9, 2011
I am trying to make a navigation menu that when a link is clicked, loads content into a hidden div, then shows the hidden div, then changed the class of the list item. If the same link is clicked again the class reverts back to what it was before and then the content div becomes hidden.
[Code]...
View 3 Replies
View Related
Oct 5, 2010
I have an accordion effect setup on a a nested list. The effect is working great however, I want to retain the menu state (e.g. which section is open) when a user clicks a particular link and the site loads a new page.How do I do this with jQuery?Here is the jQuery I have currently:
$(document).ready(function(){
$('.boxCategories ul > li ul')
.click(function(e){
[code]....
View 10 Replies
View Related
Jul 26, 2011
I've got this client that would like the menu to slide out from the left nav bar, horizontally. So far I've put together a jQuery toggle you can see working here:Slide out Menu.What I need is to fade out/slide back when another menu link is clicked. Right now they are overlapping and there are more menu items to come.
View 2 Replies
View Related
Oct 7, 2010
I awhen it comes to "developing" jQuery but I am trying to do something that is seemingly something simple but I can't for the life of me, figure out the best way to do it.
http:[url].....
Here, you'll see the area below the navigation that has five buttons which are supposed to help scroll between the five associated divs.All I want to do is hide the currently shown div and then slide in the div associated with the button clicked.http:[url].....Here is what the animation is SUPPOSED to look like but the problem is is that the correct one uses Prototype and I am trying to use only one library and jQuery is the most suitable because I use it for other effects in the site and jQuery and Prototype obviously don't mesh well.
View 3 Replies
View Related
Jun 15, 2009
I have been working on a dropdown menu using Clarklab's Tutorial:The only problem is that this tutorial only shows how to create one dropdown instance.It's in use here:My issue is that when I click on one menu item, all the submenus open up. Is there a simple fix that I just haven't figured out yet?My instinct is to give each ul it's own id, but I'm not sure how to direct the jquery in the header to work with individual elements.
View 2 Replies
View Related