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

    Share
    avatar
    MrMind
    Normal User

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

    Reputation points:

    Profile information Toogle

    Post by MrMind on 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
    avatar
    Japorized
    Administrator

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

    Reputation points:

    Re: Profile information Toogle

    Post by Japorized on 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


    ______________________________
    The higher you fly, the harder you fall? I'll just fly to a height where I'd be able to regain flight even before hitting the ground. What the heck, you say? I'm just that persistent / determined / stubborn, whichever you may call it.

    HummingBird
    avatar
    MrMind
    Normal User

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

    Reputation points:

    Re: Profile information Toogle

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

    Yes. That effect is perfect!
    avatar
    Japorized
    Administrator

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

    Reputation points:

    Re: Profile information Toogle

    Post by Japorized on 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.


    ______________________________
    The higher you fly, the harder you fall? I'll just fly to a height where I'd be able to regain flight even before hitting the ground. What the heck, you say? I'm just that persistent / determined / stubborn, whichever you may call it.

    HummingBird
    avatar
    MrMind
    Normal User

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

    Reputation points:

    Re: Profile information Toogle

    Post by MrMind on 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!
    avatar
    Japorized
    Administrator

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

    Reputation points:

    Re: Profile information Toogle

    Post by Japorized on 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


    ______________________________
    The higher you fly, the harder you fall? I'll just fly to a height where I'd be able to regain flight even before hitting the ground. What the heck, you say? I'm just that persistent / determined / stubborn, whichever you may call it.

    HummingBird

    Sponsored content

    Click to toggle info

    Reputation points:

    Re: Profile information Toogle

    Post by Sponsored content


      Current date/time is Fri Jul 28, 2017 9:34 am