Reply
Hidden content till clicked help
Old 10-14-2009, 07:08 PM Hidden content till clicked help
Skilled Talker

Posts: 95
Name: Brian
Trades: 0
I want to add on my website where I can hide content, and have a more button that the user can click if they want to see the additional information. If you are unsure of what I am talking go to rottentomatoes and click any movie. Then it will have it under the description section.
bdg1115 is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 10-14-2009, 07:25 PM Re: Hidden content till clicked help
chrishirst's Avatar
Super Moderator

Posts: 22,277
Location: Blackpool. UK
Trades: 0
http://www.dustindiaz.com/seven-togglers/
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | People Counting System | Bits & Bobs
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-14-2009, 07:39 PM Re: Hidden content till clicked help
Skilled Talker

Posts: 95
Name: Brian
Trades: 0
its not working out for me.. a bit confused here.
bdg1115 is offline
Reply With Quote
View Public Profile
 
Old 10-14-2009, 07:57 PM Re: Hidden content till clicked help
chrishirst's Avatar
Super Moderator

Posts: 22,277
Location: Blackpool. UK
Trades: 0
Ok, very very simple bit of code to show the basic principle.
HTML Code:
<div onclick="document.getElementById('hidden').style.visibility='visible';" >Show hidden text</div>
<div id="hidden" style="visibility:hidden;"> This is hidden until a click shows it</div>
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | People Counting System | Bits & Bobs
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-14-2009, 08:56 PM Re: Hidden content till clicked help
Skilled Talker

Posts: 95
Name: Brian
Trades: 0
I found this one that works great, and its what I was looking for. Your page lead me to it. Thanks for the help.

My only problem now is that my page loads again when I click it. I dont want it to again, just show the content without having to scroll looking for it again. You know what I mean?
bdg1115 is offline
Reply With Quote
View Public Profile
 
Old 10-14-2009, 08:57 PM Re: Hidden content till clicked help
Skilled Talker

Posts: 95
Name: Brian
Trades: 0
is there an added code I can do to fix that?
bdg1115 is offline
Reply With Quote
View Public Profile
 
Old 10-15-2009, 12:52 AM Re: Hidden content till clicked help
Skilled Talker

Posts: 95
Name: Brian
Trades: 0
I think the term is "slide" out? haha I dont know. I've been doing websites for a while, but not much coding. Just basic stuff.
bdg1115 is offline
Reply With Quote
View Public Profile
 
Old 10-15-2009, 04:53 AM Re: Hidden content till clicked help
chrishirst's Avatar
Super Moderator

Posts: 22,277
Location: Blackpool. UK
Trades: 0
Quote:
My only problem now is that my page loads again when I click it. I dont want it to again, just show the content without having to scroll looking for it again. You know what I mean
I'd be guessing at this because I have no idea what code you are using, but I'd suggest you are using a link to show the hidden element rather than a element onclick event.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | People Counting System | Bits & Bobs
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-15-2009, 11:53 AM Re: Hidden content till clicked help
Skilled Talker

Posts: 95
Name: Brian
Trades: 0
This is a sample of my code:
Code:
<script type="text/javascript">
<!--
    function toggle_visibility(id) {
       var e = document.getElementById(id);
       if(e.style.display == 'block')
          e.style.display = 'none';
       else
          e.style.display = 'block';
    }
//-->
</script>
Then:

Code:
<div id="extend" style='display:none;'>Content.................</div>

<a href="#" onclick="toggle_visibility('extend');">[More]</a>

Last edited by bdg1115; 10-15-2009 at 11:55 AM..
bdg1115 is offline
Reply With Quote
View Public Profile
 
Old 10-15-2009, 11:57 AM Re: Hidden content till clicked help
chrishirst's Avatar
Super Moderator

Posts: 22,277
Location: Blackpool. UK
Trades: 0
having href="#" will make the current page reload when it is clicked so the element will "reappear"
Quote:
but I'd suggest you are using a link to show the hidden element rather than a element onclick event
Pretty good guess doncha think?
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | People Counting System | Bits & Bobs
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-15-2009, 12:00 PM Re: Hidden content till clicked help
Skilled Talker

Posts: 95
Name: Brian
Trades: 0
haha yup. pretty good.

What would be the code to put in there?
bdg1115 is offline
Reply With Quote
View Public Profile
 
Old 10-15-2009, 12:03 PM Re: Hidden content till clicked help
chrishirst's Avatar
Super Moderator

Posts: 22,277
Location: Blackpool. UK
Trades: 0
just leave out the href completely or use a span/div with an onclick event as my code does.

If you want the cursor to change, add cursor: pointer; to a style rule for that element.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | People Counting System | Bits & Bobs
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-15-2009, 12:13 PM Re: Hidden content till clicked help
Skilled Talker

Posts: 95
Name: Brian
Trades: 0
Awesome, that worked great. I should of listened sooner haha.

Is there a way I can get rid of the space it creates? It kind of puts the text space in there, but you just cannot see it until I click "more" and it fills it in.

Here is a link to the page, so you can maybe get an idea of what I am talking about.

http://www.exclusivetent.info/technical

Look under the 80% Shade Fly section, that is the only part that works for now. There is that space. Is it possible to put the More right after the word "end"? Then once clicked it gets extended down? Then once clicked again it will go away.

Sorry for being so picky.. haha

Last edited by bdg1115; 10-15-2009 at 12:15 PM..
bdg1115 is offline
Reply With Quote
View Public Profile
 
Old 10-15-2009, 12:19 PM Re: Hidden content till clicked help
chrishirst's Avatar
Super Moderator

Posts: 22,277
Location: Blackpool. UK
Trades: 0
set the style to display:none; initially.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | People Counting System | Bits & Bobs
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-15-2009, 12:23 PM Re: Hidden content till clicked help
Skilled Talker

Posts: 95
Name: Brian
Trades: 0
not working out ...
bdg1115 is offline
Reply With Quote
View Public Profile
 
Old 10-15-2009, 01:35 PM Re: Hidden content till clicked help
Skilled Talker

Posts: 95
Name: Brian
Trades: 0
I had an ah ha moment, and figured it out. Thanks for all your help Chris!
bdg1115 is offline
Reply With Quote
View Public Profile
 
Old 10-15-2009, 01:49 PM Re: Hidden content till clicked help
chrishirst's Avatar
Super Moderator

Posts: 22,277
Location: Blackpool. UK
Trades: 0
http://www.modtalk.co.uk/_site/code/.../text-element/

code is in the source.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | People Counting System | Bits & Bobs
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-15-2009, 01:51 PM Re: Hidden content till clicked help
chrishirst's Avatar
Super Moderator

Posts: 22,277
Location: Blackpool. UK
Trades: 0
Should really have refreshed the page instead of listening to the radio
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Growing old is mandatory - Growing up is optional
Code Samples | People Counting System | Bits & Bobs
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 10-16-2009, 11:11 AM Re: Hidden content till clicked help
Junior Talker

Posts: 2
Trades: 0
Quote:
Originally Posted by bdg1115 View Post
haha yup. pretty good.

What would be the code to put in there?
Make the link on your href="javascript:void(0)"

that way it wont do anything when you click but it is technically still a link.
nobi410 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Hidden content till clicked help
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 



Page generated in 0.17131 seconds with 13 queries