Anyone Know The Code For This Function?

by GlenH
11 replies
Hi All,

I'm wondering if anyone knows the code that works this function.

If you go to this page https://www.lottosend.com/faq you will see a list of questions.

If you click the question, you see the answer popup directly under the question.

If you then click the 'question' again, the answer closes and the question only is visible

Glen
#code #function
  • Profile picture of the author joe ferdinando
    Glen check this out:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
    <title>Toggle Test</title>
    
    <style type="text/css">
    #ToggleTarget {
    	display: none;
    }
    </style>
    
    <script type="text/javascript">
    function Toggle() {
    	var el = document.getElementById("ToggleTarget");
    	if (el.style.display == "block") {
    		el.style.display = "none";
    	}
    	else {
    		el.style.display = "block";
    	}
    }
    </script>
    </head>
    
    <body>
    
    <p><a href="javascript:Toggle();">Question1...Bla bla bla</a></p>
    
    <div id="ToggleTarget">The anwser to the question is<br />And the bla bla bla.</div>
    
    </body>
    </html>
    If you would like to add another question:

    Code:
    <body>
    
    <p><a href="javascript:Toggle();">Question1...Bla bla bla</a></p>
    
    <div class="ToggleTarget">The anwser to the question is<br />And the bla bla bla.</div>
    
    <p><a href="javascript:Toggle();">Question2...Bla bla bla</a></p>
    
    <div class="ToggleTarget">The anwser to the question is<br />And the bla bla bla.</div>
    </body>
    you can also try this code;

    Code:
    try this in you html page
    
    <p><a onclick="javascript:ShowHide('HiddenDiv')">Show/Hide</a></p>
    <div class="mid" id="HiddenDiv" style="display: none;">This text was hidden</div>
    <script type="text/javascript">// <![CDATA[
    function ShowHide(divId)
    {
    if(document.getElementById(divId).style.display == 'none')
    {
    document.getElementById(divId).style.display='block';
    }
    else
    {
    document.getElementById(divId).style.display = 'none';
    }
    }
    // ]]></script>
    if you are using wordpress there are plugins that do this, look for short code type plugins!

    Originally Posted by GlenH View Post

    Hi All,

    I’m wondering if anyone knows the code that works this function.

    If you go to this page https://www.lottosend.com/faq you will see a list of questions.

    If you click the question, you see the answer popup directly under the question.

    If you then click the ‘question’ again, the answer closes and the question only is visible

    Glen
    Signature
    {{ DiscussionBoard.errors[9022193].message }}
    • Profile picture of the author GlenH
      Thanks Joe,

      I appreciate all that effort you went to
      {{ DiscussionBoard.errors[9022888].message }}
      • Profile picture of the author joe ferdinando
        Glen

        your welcome, if it works for you click thanks at bottom right!

        Originally Posted by GlenH View Post

        Thanks Joe,

        I appreciate all that effort you went to
        Signature
        {{ DiscussionBoard.errors[9023236].message }}
  • Profile picture of the author CelestineGrayson
    Thanks joe That is looking useful For me too...
    Heyi can i add you in my contacts..??
    {{ DiscussionBoard.errors[9023245].message }}
    • Profile picture of the author joe ferdinando
      Originally Posted by CelestineGrayson View Post

      Thanks joe That is looking useful For me too...
      Heyi can i add you in my contacts..??
      yes you can
      Signature
      {{ DiscussionBoard.errors[9023252].message }}
  • Profile picture of the author webexperttech01
    Banned
    [DELETED]
    {{ DiscussionBoard.errors[9023277].message }}
    • Profile picture of the author shahriyar
      Originally Posted by webexperttech01 View Post

      Hello,

      How to create SEO friendly URL in PHP.
      my old url included in ? = % but i want to create /services.php or /keywords.php
      please suggest me code
      I think you should open your own thread for this questions (as it is not related to the topic).
      {{ DiscussionBoard.errors[9032401].message }}
      • Profile picture of the author David Beroff
        Originally Posted by shahriyar View Post

        I think you should open your own thread for this questions (as it is not related to the topic).
        S/he did, but wasn't satisfied with the responses.
        Signature
        Put MY voice on YOUR video: AwesomeAmericanAudio.com
        {{ DiscussionBoard.errors[9032559].message }}
    • Profile picture of the author joe ferdinando
      Originally Posted by webexperttech01 View Post

      Hello,

      Code:
      How to create SEO friendly URL in PHP.
      my old url included in ? = %  but i want to create /services.php or /keywords.php
      please suggest me code
      Code:
      To create SEO friendly URLs all you need is a little file called .htaccess.
      
      
      Step 1
      Open up your text editor and type the following:
      RewriteEngine On
      RewriteRule ^([^/.]+)/?$ /index.php?page=$1
      
      Save this as .htaccess and upload to your webserver.
      If you type www.yoursite.com/example, the Apache web server will now interpret it as www.yoursite.com/index.php?page=example
      
      
      Step 2
      The SEO friendly URLs should work now, but you also need a PHP script that will include the subpages.
      The following script is set to include all pages from a directory called "inc", but change it to whatever you like.
      
      Note: This should be in your index.php file where the main content appear.
      <?php
      $page = $_GET['page'];
       
      $def = "home";
      $dir = "inc";
      $ext = "php";
       
      if (isset($page)) {
          $page = substr(strtolower(preg_replace('([^a-zA-Z0-9-/])', '', $page)), 0, 20);
          if (file_exists("$dir/$page.$ext") and is_readable("$dir/$page.$ext")) {
              include("$dir/$page.$ext");
          }
          else {
              include("$dir/error404.$ext");
          }
      }
      else {
          include("$dir/$def.$ext");
      }
      ?>
      
      
      Step 3
      Change all internal links and replace them with your new SEO links.
      For example, if you have a link to index.php?page=about, change this to about.
      
      You're finished! Open your website and try to enter the short SEO friendly URL.
      If this helps click thanks at bottom right!
      Signature
      {{ DiscussionBoard.errors[9032653].message }}
  • Profile picture of the author w13
    Just use shortcode plugin or use ccr-colorful-faq plugin from codexcoder
    {{ DiscussionBoard.errors[9113609].message }}
  • Profile picture of the author David Beroff
    I recently started learning jQuery, and it seems perfect for this. Try this (free) course to learn more: Code School - Try jQuery
    Signature
    Put MY voice on YOUR video: AwesomeAmericanAudio.com
    {{ DiscussionBoard.errors[9113638].message }}
    • Profile picture of the author PradeepShivam
      <html lang="en">

      <head>

      <meta charset="utf-8">

      <title>slideToggle demo</title>

      <style>

      p {

      width: 400px;

      }

      </style>

      <script src="//code.jquery.com/jquery-1.10.2.js"></script>

      </head>

      <body>


      <p id="Ques">Question</p>

      <p id="Answer">

      This is the paragraph to end all paragraphs. You

      should feel <em>lucky</em> to have seen such a paragraph in

      your life. Congratulations!

      </p>


      <script>

      $( "#Ques" ).click(function() {

      $( "#Answer" ).slideToggle( "slow" );

      });

      </script>


      </body>

      </html>




      use Jquery for animation effect of toggling above - sample code




      {{ DiscussionBoard.errors[9139083].message }}

Trending Topics