InfinityHub



Welcome to InfinityHub !


We're a leisure community and this board serves for us to discuss various different topics. We aim to foster relationships between users and grow to be a great community.


So join us! We've been expecting you. :)


Log In | Register

InfinityHub



Welcome to InfinityHub !


We're a leisure community and this board serves for us to discuss various different topics. We aim to foster relationships between users and grow to be a great community.


So join us! We've been expecting you. :)


Log In | Register
Log In


Forgot Password?



Option not recommended on shared computers

Don't have an account yet?



InfinityHub




    Profile information Toogle

    MrMind
    MrMind
    Normal User

    Click to toggle info
    Posts : 24
    HubPoints : 22
    Rep : 0
    Join date : 2014-07-31

    Reputation points:

    Profile information Toogle Empty Profile information Toogle

    Post by MrMind Sun Aug 24, 2014 12:57 am

    Hello,

    I have been trying to find that code but i couldn't. Is it possible that you guys could help me find the code?

    Thanks,
    MrMind
    Japorized
    Japorized
    Administrator

    Click to toggle info
    Posts : 365
    HubPoints : 95
    Rep : 12
    Join date : 2014-07-28
    Age : 29
    Location : In my hidey hole...

    Reputation points:

    Profile information Toogle Empty Re: Profile information Toogle

    Post by Japorized Sun Aug 24, 2014 10:43 am

    You mean the toggle that I have here for the profile fields in posts?

    I shall move this to the programming forum since it's about that topic
    MrMind
    MrMind
    Normal User

    Click to toggle info
    Posts : 24
    HubPoints : 22
    Rep : 0
    Join date : 2014-07-31

    Reputation points:

    Profile information Toogle Empty Re: Profile information Toogle

    Post by MrMind Sun Aug 24, 2014 5:17 pm

    Yes. That effect is perfect!
    Japorized
    Japorized
    Administrator

    Click to toggle info
    Posts : 365
    HubPoints : 95
    Rep : 12
    Join date : 2014-07-28
    Age : 29
    Location : In my hidey hole...

    Reputation points:

    Profile information Toogle Empty Re: Profile information Toogle

    Post by Japorized Mon Aug 25, 2014 2:26 am

    It's the jQuery toggle effect so first thing that you have to do is to get the jQuery library loaded for your forum. If you've already have that, then you can skip this first step. If not, you can link it to the Google Apis host. Put this in your overall_header template for it to run in all pages.
    Code:
    <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

    Next is to the templates. If you have blogs activated, you'll need to do this twice.
    Go to both viewcomments_body and viewtopic_body templates and locate where the profile_field variable is.
    Encase what you want hidden in a div like this.
    Code:
    <div style="display: none;">
       <!-- BEGIN profile_field -->
          {postrow.displayed.profile_field.LABEL}{postrow.displayed.profile_field.CONTENT}{postrow.displayed.profile_field.SEPARATOR}
       <!-- END profile_field -->
       {postrow.displayed.POSTER_RPG}
    </div>
    PS: Since I'm on Invision and that I have no test forums, I do not know how the variables will differ for other forum versions.
    The style is set to display:none to hide the profile fields.

    Add another div right before it for the Toggle handler. You can set the class as anything you like but I'll use ctoggle here. So it'll now look something like this
    Code:
    <div class="ctoggle">Click me to toggle profile fields</div>
    <div style="display: none;">
       <!-- BEGIN profile_field -->
          {postrow.displayed.profile_field.LABEL}{postrow.displayed.profile_field.CONTENT}{postrow.displayed.profile_field.SEPARATOR}
       <!-- END profile_field -->
       {postrow.displayed.POSTER_RPG}
    </div>

    Next, go to your Javascript management and create a new Javascript file.
    Code:
    $(document).ready(function(){
       $('.ctoggle').click(function(){
          $(this).next().slideToggle();
       });
    });
    Things should be working already at this point. Just make sure that if you're using a class, then it's .ctoggle, and if it's an ID that you're using, then it's #ctoggle.
    And the speed of the toggling can be changed according to your liking.
    MrMind
    MrMind
    Normal User

    Click to toggle info
    Posts : 24
    HubPoints : 22
    Rep : 0
    Join date : 2014-07-31

    Reputation points:

    Profile information Toogle Empty Re: Profile information Toogle

    Post by MrMind Sat Aug 30, 2014 1:59 pm

    Thank you very much! i did whatever you said and it works fine. This works on PunBB as wel! Thanks a lot! Topic Solved!
    Japorized
    Japorized
    Administrator

    Click to toggle info
    Posts : 365
    HubPoints : 95
    Rep : 12
    Join date : 2014-07-28
    Age : 29
    Location : In my hidey hole...

    Reputation points:

    Profile information Toogle Empty Re: Profile information Toogle

    Post by Japorized Sat Aug 30, 2014 8:09 pm

    This should work for all different forum versions if you manipulate the DOM accordingly. And I'm glad that the code helped out. You're welcome Smile

    And I wouldn't say topic solved for anything cause this isn't a support forum but I will share my knowledge when requested, and if I know how.

    But seeing that it is indeed solved, hence Topic locked

    Sponsored content

    Click to toggle info

    Reputation points:

    Profile information Toogle Empty Re: Profile information Toogle

    Post by Sponsored content


      Current date/time is Fri Apr 19, 2024 3:24 pm