How to make a Digg-style FAQ page with JavaScript and jQuery

Register an Account
Pligg Chat Room
Reply
 
LinkBack Thread Tools Display Modes
  #11 (permalink)  
Old 06-09-2009, 07:13 PM
chuckroast's Avatar
Pligg Developer/Coder/Designer
Pligg Version: SVN
Pligg Template: Galleria
 
Join Date: Jun 2006
Posts: 3,829
Quote:
Originally Posted by Ganha View Post
Can somebody please answer my question?

thank you

Quote:
Hey thanks for the great tutorial the only problem is that it works when i put the code on faq.php but there only appears the faqs does not appear the whole site when i put the code on faq-en_center.tpl it gives me an error, where am i suppose to put the code?
The tutorial appears to be correct.
If you are getting an error you will need to say what the error is.
Help us help you.


Get the full Pligg Module Pack today.

Anyone want the domain MyHubb.com ? Bid Now!




Reply With Quote
  #12 (permalink)  
Old 06-09-2009, 07:19 PM
Casual Pligger
Pligg Version: 9.9.0
Pligg Template: czNet
 
Join Date: Jan 2008
Posts: 63
My queston is what is the file i am supposed to edit? i tried both faq-en_center.tpl and faq-en.php and i put the right code but it only make my site wierd and the sidebar and the whole thing dissappears.

When i put the code given by the author of this thread in faq-en_center.tpl and i open it it opens on my computer with notepad,

I think i should edit the file faq-en.php the problem is that when i open mysite.com/faq-en.php i get erros because is does now unterstand what > < and all other code from the html code means

Last edited by Ganha; 06-09-2009 at 07:42 PM.
Reply With Quote
  #13 (permalink)  
Old 06-11-2009, 09:00 AM
Casual Pligger
Pligg Version: 9.9.0
Pligg Template: czNet
 
Join Date: Jan 2008
Posts: 63
Has anybody tried this`? can somebody explain it a litlle more detailed please»?

thanks in advance
Reply With Quote
  #14 (permalink)  
Old 06-16-2009, 07:52 PM
Casual Pligger
 
Join Date: Oct 2007
Posts: 38
Rather than hiding the answers with static css, why not hide them on page load with jQuery. This way users that don't have javascript enabled will still be able to see the answers.
Reply With Quote
  #15 (permalink)  
Old 06-16-2009, 11:16 PM
Casual Pligger
Pligg Version: 9.9.0
Pligg Template: czNet
 
Join Date: Jan 2008
Posts: 63
Could you explain how that works and how to do that? a litlle tutorial would help
Reply With Quote
  #16 (permalink)  
Old 06-23-2009, 06:19 AM
New Pligger
Pligg Version: 1.0.0
 
Join Date: Jun 2009
Posts: 4
A very good tutorial. It would be nice if the suggestion by Rob472 is also incorporated in this. It will make it more useful.
Thanks.
Reply With Quote
  #17 (permalink)  
Old 06-23-2009, 08:53 AM
Casual Pligger
 
Join Date: Oct 2007
Posts: 38
Quote:
Originally Posted by Ganha View Post
Could you explain how that works and how to do that? a litlle tutorial would help
Remove the css with display:none; and add the following jQuery between the $(document).ready() part

Code:
$(".faq-answer").hide();
Reply With Quote
  #18 (permalink)  
Old 07-29-2009, 11:35 AM
New Pligger
 
Join Date: Jul 2009
Posts: 11
I have this working .... if any one needs help.... post a message in this thread and i will post the code i used.

Last edited by dasaxena; 07-30-2009 at 04:34 PM.
Reply With Quote
  #19 (permalink)  
Old 07-31-2009, 04:15 PM
New Pligger
Pligg Version: 1.0
Pligg Template: Thestandard
 
Join Date: Mar 2008
Location: Germany
Posts: 6
Hello dasaxena

it would be nice if you can post your code here

Thank you Andreas
Reply With Quote
  #20 (permalink)  
Old 03-03-2010, 10:02 PM
Casual Pligger
 
Join Date: Apr 2009
Posts: 49
Quote:
Originally Posted by dasaxena View Post
I have this working .... if any one needs help.... post a message in this thread and i will post the code i used.
I have read the instructions properly but can not seem to get this function to work...

I am using Pligg 1.0.3 wistie template. I already have the jquery.js in my js folder due to the jquery module. also, i have tried to enter the suggested code into a create page. The page was create via admin>manage>pages.

Please let me know what i am doing wrong... This is what i added to the page content:
PHP Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"
>
<
html>
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<
title>Digg-style FAQ page</title>

<
script type="text/javascript" src="jquery.js"</script>

<script type="text/javascript">
$(document).ready(function() {                                    
    $("a[name^='faq-']").each(function() {
        $(this).click(function() {
            if( $("#" + this.name).is(':hidden') ) {
                $("#" + this.name).fadeIn('slow');
            } else {
                $("#" + this.name).fadeOut('slow');
            }            
            return false;
        });
    });
});
</script>

<style type="text/css">
.faq-answer {
display:none;
}
</style>

</head>

<body>

   <a href="#" name="faq-1">What is Digg like FAQ?</a><br />
   <div class="faq-answer" id="faq-1">It's like this: http://www.digg.com/faq<br /><br /></div>
   
   <a href="#" name="faq-2">Is it easy to make?</a><br />
   <div class="faq-answer" id="faq-2">Yes it's very easy to make!<br /><br /></div>
   
   <a href="#" name="faq-3">Why would I want to do that?</a><br />
   <div class="faq-answer" id="faq-3">And your page will be so much cleaner.<br /><br /></div>
            
</body>
</html> 
Please let me know what i am doing wrong... if i need to place a jquery download in the correct folder... or if i am place things in the wrong place.... THANK YOU SO MUCH
Reply With Quote
Reply

Tags
digg, faq, make, style

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Might be time to think about better use of javascript jbowman Questions and Comments 1 07-20-2007 09:19 AM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development