Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2006
    Location
    D?sseldorf
    Posts
    2,858
    Tokens
    2,256

    Latest Awards:

    Default "Collapsing Divs"

    Wow. I feel like I'm 'using' this forum. Sorry D:

    Anyways, yes I've googled it, but there wasn't a 100% clear answer.
    At the moment, I have a script (javascript I think) where you click a link, and it toggles a div to either retract or collapse.

    However, refresh the page, or click a link, and they reset. So, is there a way to save the state of the div(s) to a cookie?

    Thanks
    Luke

  2. #2
    Join Date
    Nov 2008
    Location
    Cambridge, UK
    Posts
    901
    Tokens
    100

    Default

    Quote Originally Posted by LukeBateson View Post
    Wow. I feel like I'm 'using' this forum. Sorry D:

    Anyways, yes I've googled it, but there wasn't a 100% clear answer.
    At the moment, I have a script (javascript I think) where you click a link, and it toggles a div to either retract or collapse.

    However, refresh the page, or click a link, and they reset. So, is there a way to save the state of the div(s) to a cookie?

    Thanks
    Luke
    I can't give you code because I don't know how you have it coded, but basically, when you call the function to change the state of the div, write to a cookie. Then when loading, use some conditionals to set the default state of the div. Pretty easy
    we're smiling but we're close to tears, even after all these years

  3. #3
    Join Date
    Nov 2006
    Location
    D?sseldorf
    Posts
    2,858
    Tokens
    2,256

    Latest Awards:

    Default

    Haven't a clue how to write a cookie like that haha :L

    http://www.dynamicdrive.com/dynamici...edcollapse.htm I'm using that if it helps

    HTML Code:
    <a href="javascript:animatedcollapse.toggle('sub1')" class="title">
    Link

    HTML Code:
    <script type="text/javascript" src="js/animatedcollapse.js"></script>
    <script type="text/javascript">
    animatedcollapse.addDiv('sub1', 'fade=0,speed=400')
    animatedcollapse.addDiv('sub2', 'fade=0,speed=400')
    animatedcollapse.addDiv('sub3', 'fade=0,speed=400')
    animatedcollapse.ontoggle=function($, divobj, state){
    }
    animatedcollapse.init()
    </script>
    In the head section
    Last edited by Luke; 08-05-2010 at 07:51 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •