Niko
  • Administrator

      Reputation : 319
      Registered on : 2012-02-22
      Posts : 2366
      School of codes courses: coming soon
    Toggle content with a script

    Description


    You can hide/show an object/code/html part using a javascript and a html code

    Set up


    It is very simple... You have just to paste this script code in your forum:
    Code:
    $(document).ready(function() {  $('.info_triger').click(function() {$('#object').slideToggle(400);return false;});});


    Or use this one if you want to have it only in a page:
    Code:
    <script type="text/javascript">$(document).ready(function() {  $('.info_triger').click(function() {$('#object').slideToggle(400);return false;});});</script>


    Then use this html code (and edit it) for the lick/text that will open the "object":
    Code:
    a href="LINK" class="info_triger">Text


    And this one for the hidden message:
    Code:
    <div id="object" style="display: none;">Content</div>


    And it's done :bene:

    Customize the tutorial


    You can change the messages and the links :birra:



    Technical problems


    The tutorial was tested on this forum and with the browser Google Chrome; If you notice that the tutorial doesn't work for a browser or for a version of forum (PhpBB2, PhpBB3, PunBB, Invision) contact an administrator and we will fill this field with your reporting.

    Thanks, the staff

    For every problem or question please, contact us in the section Support for the tutorials, The staff will answer you as soon as it is possible...


    Friendly,
    The team of the Forum of Codes.



    Niko wants you in the team Guest

    Community manager and Administrator at Forumattivo.com

    Nick
    • Manager

        Reputation : 20
        Registered on : 2012-04-01
        Posts : 407
      Nice tutorial, this should come in handy.



      Toggle content with a script 15px10