I have a div tag element and a hide/show button above it. I'm able to handle the hide show of the contents all right via the button, but I want the div to be hidden when someone clicks anywhere else in the document, save inside the div area itself.This functionality is similar to what you see on the sign on panel in twitter.com. Press the sign in, the div sign in panel displays. Press the sign in link OR anywhere else on the document outside the panel. The panel is hidden.What's the best way to script this functionality in jquery?
My goal is to be able to have a page with multiple hidden DIVs. On click of a link, a single DIV (box) should appear. Now, either on second click of that link, it should close OR on click of another link the first DIV should close and the second should open. At any one time, only one DIV (box) should be visible with the option to close DIVs by clicking a second time on the open link. I have only been able to get 2/3 the way there. I am able to click on a link and open it, click a second link which closes the first and opens the second, but I don't know how to close the last open link so that no DIVs are shown, as when the page originally loaded.
Here is my example code: <html> <head> <title>Hide DIV Test Run</title> <script language="javascript"> function show(selected) { var openDiv = document.getElementsByTagName("div"); for(var x=0; x<openDiv.length; x++) { name = openDiv[x].getAttribute("name"); if (name == 'openDiv') { if (openDiv[x].id == selected) { openDiv[x].style.display = 'block'; } else { openDiv[x].style.display = 'none'; }}}} </script> <style> body { width:50%; } #openDiv1 { display:none; border:solid 2px black; width:200px; } #openDiv2 { display:none; border:solid 2px black; width:200px; } </style> </head> <body> <div id="body"> <p>This is <a href="#" id="link1" onclick="show('openDiv1')">some</a> test text. Sentence #1. <div name="openDiv" ID="openDiv1">This is the hidden text.</div> <p>This is even <a href="#" id="link2" onclick="show('openDiv2')">more</a> text. Sentence #2 <div name="openDiv" ID="openDiv2">This is more hidden text.</div> </div> </body> </html>
I want to show hide a div and its content when show or hide button is pressed. How i can do it. it is a asp.net button and i also don't want the page to postback when button is clicked.
I'm trying to do a show/hide on a radio button click and I do have it working, but I'd like to make it more...extensible/independent of hard- coding children elements to show hide.
My dummy html structure is:
I left some commented out stuff at the top of the function, hopefully to give you an idea of what I tried.
In particular:
I was trying to get the first ul (the children to show/hide) on "this" (the radio button clicked). I'd like this to be flexible to where you could add more radio button/children and as long as the structure stays the same, the show/hide functionality works.
I am trying to save the state of visibility (hidden or visible) of a portlet as a variable so that It can be saved. Hopefully allowing the user to return to the page without having to toggle portlets open/close again.
My issue: Unable to correctly establish whether or not the clicked portlet is visible or hidden while assigning a variable to be used as post data to a database.
Here is the code so far
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html lang="en"> <head>
I have a class hidden by default at the document ready state. I use the show() function when its parent has been clicked and I want to be able to apply a click function to this newly visible element - when I write it I am finding that it is overriding the initial hide(). How do I work around this? I should say that this element is just a bit of text that says "close x" and will be used to "close" its parent div down...
I have a user name, password, phone number etc., that all need to be validated before being submitted. The functions filter out the unwanted characters and null and zero length strings. I did have a pop up that listed the errors but I would prefer them to be listed below the log in screen that is a hidden div.I cannot get it to work.The validation works fine,
I have the following code that don't work like i want it.
Code: function hideDisplaySingleSuite(textstring) { var myclass1 = new RegExp('\b'+textstring+'\b'); //Populate the array with all the page tags[code]....
For example.It show objects if I remove the if statement that checks if the class is visible.for example this shows a class and works.
Code: function hideDisplaySingleSuite(textstring) { var myclass1 = new RegExp('\b'+textstring+'\b'); //Populate the array with all the page tags[code]....
So my question is why don't this work on a class, it works on an "id"?
Code: if (allPageTags[i].style.display ==''){ allPageTags[i].style.display = 'none'; }[code]....
I want to show the class if its not visible or hide it if it is visible.How can this be done?
I managed to write show hide sub row for my table.the first row of my table is master and the immediate next row is detail , I am hiding all detail rows initially. and when user click on any tr the next row which is hidden is made visible .
I have a table that contains information that is hidden within a 'td' element. Users can access this information if they wish by clicking on a link that is held in another 'td' element on the previous row (table structure below):
I have 2 divs on the page, div1 has a gif animation in it and div2 is the page content. I want to hide div2 and only show div1 which plays the gif, then after some time div1 fades away and div2 fades up to show the page content.
This is my thought process:
1) On doc ready, hide div2 2) after 3000 fade div1 out 3) fade div2 in
$(document).ready (function(){ $('#div2')hide();
but I dont know how to fade out the div after a time and fade in the other div.
I am creating a static(only raw data) web site and want to show a panel as following.
Contact us panel
label1 Label2 Label3
when label1 click it would show as below
Label1-> on click Label 1 Label 1 details abc location bla bla
how i can achive funtionality to click on label 1 and show details data and again clicking hides label1 data I am using page breeze html editior, Is it possible i can use java script functions in it,
I'm basically trying to make it so a link click will hide and display a series of DIVs to make my site look a bit neater and more professional. The code I have WORKS, it can make a DIV appear and disappear easily enough but the issue I'm having is that it only works if you click the same link to show nad hide. Click a link to show a DIV then click another link and both will be visible.
But the only other code I tried to hide all but the selected DIV just results in my page becoming invisible (Its constructed with DIVs from top to bottom) so its not a suitable result. I'm basically after this: [URL]. Where you click on the link (in this case an image) and it shows what you need. I did try searching through their HTML and code but their javascript file appears as one long string to me so its hard to find any real useful detail.
This is the code I have at the moment: Code JavaScript: function showHide(shID) { if (document.getElementById(shID)) { if (document.getElementById(shID).style.display != 'block') { document.getElementById(shID).style.display = 'block'; }else { document.getElementById(shID).style.display = 'none'; }}}
And this is my current page in practice. [URL]. I'm assuming I might need an array but I need to stop it picking on every DIV and only the DIVs in my content area.
In IE, Safari, Chrome, and Opera (to an extent, still some bugs to work out there) the search suggestions show when you type in the box, and hide when you click away from the box, then re-appear when you click in the search box. In Firefox, however, the suggestions still show even when you click away from the box. I can't really figure out why it's happening, I've tried setting the CSS properties for both visibility and display, but neither worked. Here's the code for that part:
I'm not quite sure what this is called (tooltip, dialogue, popup, show/hide) but I've seen it around... I'd like to accomplish the following, as indicated in the attached image.
I want an image to automatically appear upon a user's visit 'pointing' to a specific link on my nav bar.
Ideally, this will load on users visit, then not load if/when they click the [x]...
How To show Div After Click (tell friend) link and hide div after onsubmit form ? (Using Jquery or java script) Example : TELL FRIENDS CLICK LINK <div id="formhide"></div> (default is hidden). After Click Show Loading Message and show form for send data to any email . so if Form is valid Show loading message and message Success ! so hide dive ( to default).
I'm testing a page with a .js hide/show <div> overlay to hide/show a video player. The image of the video screen in the center of the page, when clicked, opens a hidden <div> overlay. It works but it requires the viewer to double click the first time. What needs to change to make it "show" the <div> on the first click? Once the video <div> is displayed, then it works every time with just one click to hide or show. It's just the first time that requires two clicks to get it to work. Here is the page: [URL]
Here is the code used to implement the hide show, in the <head>:
Code: <!-- Elements Needed for Video Player Popup --> <!-- The javascript hide/show --> <script type="text/javascript" language="JavaScript"> <!-- function HideContent(d) { document.getElementById(d).style.display = "none"; } function ShowContent(d) { document.getElementById(d).style.display = "block"; } function ReverseDisplay(d) { if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; } else { document.getElementById(d).style.display = "none"; } } //--> </script> a And on the image, which acts as the button: Code: <a href="javascript:ReverseDisplay('mediaspace2')"> <img src="images/vid_button_image.jpg" width="376" height="282" border="0" /></a>
I'm skinning my video player for my new site, I have the following code: click:function(){a.trigger("togglePlay");return false}}) How can i edit this code to add a SECOND function of making the button opacity: 0 or just dissapear alltogether once clicked aswell?