CSS Show Hide with JS

This is a discussion on "CSS Show Hide with JS" within the JavaScript Forum section. This forum, and the thread "CSS Show Hide with JS are both part of the Program Your Website category.



 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1  
Old Dec 10th, 2007, 01:26
New Member
Join Date: Oct 2007
Location: Sheffield
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
CSS Show Hide with JS

I have used some CSS found on a website that allows me to show and hide an element in a page (this can be found at http://www.stunicholls.com/various/more.html, if you look at this page you can see the more>> button displays a hidden element. My problem is that this newly showed element can be clicked anywhere and becomes hidden, can anyone tell me how to stop this from happening?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Dec 10th, 2007, 01:37
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,611
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Re: CSS Show Hide

The "more" content will only closed when you clicked in it. If you clicked outside from it, it won't close.
I think what you tyring to archieve here is not done by CSS, it's has to do with Javascript
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Dec 10th, 2007, 01:50
Highly Reputable Member
Join Date: Sep 2007
Age: 15
Posts: 717
Blog Entries: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS Show Hide

The example site that you posted the link to uses JavaScript! Take a look:
Code: Select all
clickMenu = function(menu,element,cname) {
	var getEls = document.getElementById(menu).getElementsByTagName(element);

	for (var i=0; i<getEls.length; i++) {
			getEls[i].onclick=function() {
			if ((this.className.indexOf(cname))!=-1)
			{
			if ((this.className.indexOf('click'))!=-1) {
				this.className=this.className.replace("click", "");;
				}
				else {
				this.className+=" click";
				}
			}
		}
	}
}
Last Blog Entry: Windows Vista vs. Mac Leopard (Nov 4th, 2007)

Last edited by Stuart; Dec 10th, 2007 at 02:04. Reason: Forgot the code!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Dec 10th, 2007, 09:15
welshstew's Avatar
Site Admin

SuperMember
Join Date: May 2007
Location: inside the outside
Posts: 1,691
Blog Entries: 14
Thanks: 3
Thanked 32 Times in 30 Posts
Re: CSS Show Hide with JS

Some other resources that you can llok at for this are:
http://www.dyn-web.com/dhtml/show-hide/
http://www.adesdesign.net/php/tutori.../hide_div.html
http://www.geocities.com/technofundo.../showhide.html
http://www.plus2net.com/javascript_t...hide-layer.php

I'm not very good with JS but hte above wmay help you de-bug, or at least give you a soultion that fits your purpose.
__________________
WelshStew Site Admin
If you think I've helped, click the "Thanks"
tierney rides tboard - uk site | xtreme wales - extreme clothing
WebForumz - facebook | LinkedIn
Last Blog Entry: Phorm approved for UK rollout (Sep 17th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Dec 13th, 2007, 05:39
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,611
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Re: CSS Show Hide with JS

I think that I found this same problem few month ago while I am coding the Page Option thing!

Try this link: Div Popup!
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Show/hide/add textfields from dropdownmenu UD2006 JavaScript Forum 0 Apr 9th, 2008 08:36
[SOLVED] Show&amp;Hide Div Box Maska JavaScript Forum 6 Oct 1st, 2007 11:04
Show/Hide JS pa007 JavaScript Forum 0 Apr 6th, 2007 19:18
Show and Hide Text - how do I do that? Love2Java JavaScript Forum 1 Mar 29th, 2007 00:23
Show/Hide Div Help Trebz JavaScript Forum 2 Feb 21st, 2006 22:37


All times are GMT. The time now is 01:49.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42