Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Animated, Sliding, Collapsible DIV
Old 10-01-2008, 04:10 PM Animated, Sliding, Collapsible DIV
Skilled Talker

Posts: 94
Trades: 0
I have found this site about how to make a Collapsible DIV using Javascript and I love it. I am using it on a Joomla powered site. However, I am having just one problem, and that is how to make it stay collapsed when changing pages. I have the div starting out as open, and then you can click to have it collapse, but the problem is that when you go to another page it starts open again.

I really need some help with this. Thank you.

here is the site with the details of it...

http://www.harrymaugans.com/2007/03/...cript-and-css/
IG88 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-01-2008, 04:17 PM Re: Animated, Sliding, Collapsible DIV
Novice Talker

Posts: 5
Name: Mikael Bergkvist
Trades: 0
Saving states is what widgetplus is about.
http://www.widgetplus.com
amikael is offline
Reply With Quote
View Public Profile
 
Old 10-01-2008, 04:38 PM Re: Animated, Sliding, Collapsible DIV
Skilled Talker

Posts: 94
Trades: 0
Thank you for introducing me to Widget+, but I really do not think that this applies here. Unless you can explain it to me better.
IG88 is offline
Reply With Quote
View Public Profile
 
Old 10-01-2008, 04:42 PM Re: Animated, Sliding, Collapsible DIV
VirtuosiMedia's Avatar
Web Design Made Simple

Posts: 1,228
Trades: 0
There are two ways you can save the state: using a session or a cookie. Cookies are probably easier to implement in this case.
__________________
Want new web resources every day? - Follow me on
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
VirtuosiMedia is offline
Reply With Quote
View Public Profile Visit VirtuosiMedia's homepage!
 
Old 10-01-2008, 04:49 PM Re: Animated, Sliding, Collapsible DIV
Skilled Talker

Posts: 94
Trades: 0
I might be interested in using a cookie, but I have never done so before. Any helpful info you could send me to? I will look through Google as well. Thank you.

I wonder how YooTheme does it.

http://tools.yootheme.com/yootools/e...otoppanel.html
IG88 is offline
Reply With Quote
View Public Profile
 
Old 10-01-2008, 05:20 PM Re: Animated, Sliding, Collapsible DIV
Novice Talker

Posts: 5
Name: Mikael Bergkvist
Trades: 0
http://www.widgetplus.com/basic.htm

This shows a simple way to save state across pageloads.
amikael is offline
Reply With Quote
View Public Profile
 
Old 10-01-2008, 05:22 PM Re: Animated, Sliding, Collapsible DIV
VirtuosiMedia's Avatar
Web Design Made Simple

Posts: 1,228
Trades: 0
Quirksmode has a good tutorial on cookies, as does W3Schools.
__________________
Want new web resources every day? - Follow me on
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
VirtuosiMedia is offline
Reply With Quote
View Public Profile Visit VirtuosiMedia's homepage!
 
Old 10-01-2008, 08:56 PM Re: Animated, Sliding, Collapsible DIV
Skilled Talker

Posts: 94
Trades: 0
Thanks, I will look into it.

Does any one else have any other suggestions?
IG88 is offline
Reply With Quote
View Public Profile
 
Old 10-02-2008, 10:18 AM Re: Animated, Sliding, Collapsible DIV
Skilled Talker

Posts: 94
Trades: 0
Ok, I am going the cookie route. It seems to be the most logical for such a small thing. Here is what I have...

poster being the DIV

Code:
function createCookie(poster,value,0) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime()+(days*24*60*60*1000));
        var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";
    document.cookie = poster+"="+value+expires+"; path=/";
}

function readCookie(poster) {
    var posterEQ = poster + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++) {
        var c = ca[i];
        while (c.charAt(0)==' ') c = c.substring(1,c.length);
        if (c.indexOf(posterEQ) == 0) return c.substring(posterEQ.length,c.length);
    }
    return null;
}

function eraseCookie(poster) {
    createCookie(poster,"",-1);
}
I have put the call for this cookie in the HTML page...
Code:
<script type="text/javascript" src="js/toppanel-cookie.js"></script>
However, Where do I go from here? Am I even doing this right?
IG88 is offline
Reply With Quote
View Public Profile
 
Old 10-02-2008, 06:53 PM Re: Animated, Sliding, Collapsible DIV
Skilled Talker

Posts: 94
Trades: 0
Can anyone help me make a cookie for this?
IG88 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Animated, Sliding, Collapsible DIV
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.30014 seconds with 12 queries