-
AuthorPosts
-
October 12, 2006 at 7:51 pm #117381
I understand that the script uses a cookie to remember the last tab you clicked so that it’s open next time you visit the page. That is really cool but unfortunately not practical in my case.Is there a way to make it open the first tab by default instead? My tabs are on the home page only and the first tab really belongs to “home.” It’s confusing to click “Home” and something else opens up. Thanks for your help. 🙂
Pam
October 16, 2006 at 3:59 pm #211049This is becoming an urgent issue. Is there anyone who can help? Thanks.
PamOctober 16, 2006 at 7:20 pm #211055Sorry no answer for your question, but I have one on my own that is similar. Is there any way to get the tabs to open randomly each time you reload the site?
ha le-viet Developerha le-viet
- Join date:
- April 2006
- Posts:
- 415
- Downloads:
- 0
- Uploads:
- 26
- Thanked:
- 5 times in 1 posts
October 16, 2006 at 10:33 pm #211059Hi Pam, I’m sorry for replying late to your issue.
To do what you want, just go to the file moo.fx.config.js and change the code around line 61st to line 72nd
if (showingmoo!=null) {
if (mooshowed == "true") {
if (j_oldtab) j_oldtab.className = j_display + j_displayhover;
} else {
currentstretcher.fx.hide();
}
} else {
headtab = stretchers[0].id.replace(j_stretcher, j_display);
j_oldtab = document.getElementById(headtab);
j_oldtab.className = j_display + j_displayhover;
ja_Accord.clearAndToggle(stretchers[0]);
}… to this code
headtab = stretchers[0].id.replace(j_stretcher, j_display);
j_oldtab = document.getElementById(headtab);
j_oldtab.className = j_display + j_displayhover;
ja_Accord.clearAndToggle(stretchers[0]);and for Tomas, it will be this code:
headtab = stretchers[Math.floor(Math.random() * toggles.length)].id.replace(j_stretcher, j_display);
j_oldtab = document.getElementById(headtab);
j_oldtab.className = j_display + j_displayhover;
ja_Accord.clearAndToggle(stretchers[Math.floor(Math.random() * toggles.length)]);Hope this will help. Regards,
Ha Le-Viet.October 17, 2006 at 12:58 am #211060Hello Ha Le-Viet,
Thanks so much for your response. Your solution *almost* works. I switched out the file, deleted the cookies, and refreshed the page. Now what happens is this: If I have clicked, say, the third tab, and then I click on the home link in the main menu, it opens the first tab with the contents of the third tab open underneath.
If you can help solve ths problem, that would be great! Thanks,
Pamha le-viet Developerha le-viet
- Join date:
- April 2006
- Posts:
- 415
- Downloads:
- 0
- Uploads:
- 26
- Thanked:
- 5 times in 1 posts
October 17, 2006 at 1:59 am #211062Hi Pam,
Can I have the URL of your site. I’ve test this code in mine and it performed exactly like what you want.
Regards,
Ha Le-Viet.October 17, 2006 at 2:15 am #211064Sent via PM. Thanks,
Pamha le-viet Developerha le-viet
- Join date:
- April 2006
- Posts:
- 415
- Downloads:
- 0
- Uploads:
- 26
- Thanked:
- 5 times in 1 posts
October 17, 2006 at 2:39 am #211065Finally I decide to slim the init function without cookie enhanced. Please replace your init function in moo.fx.config.js file.
function init(){
var stretchers = document.getElementsByClassName(j_stretcher); //div that stretches
var toggles = document.getElementsByClassName(j_display); //spans where I click on//accordion effect
var ja_Accord = new fx.Accordion(
toggles, stretchers, {opacity: j_opacity, duration: j_delay, transition: j_transition}
);ja_Accord.showThisHideOpen = function(toShow) {
this.elements.each(function(el, i) {
if (el.offsetHeight > 0 && el != toShow) this.clearAndToggle(el);
}.bind(this));
setTimeout(function(){this.clearAndToggle(toShow) ;}.bind(this), this.options.delay);
};headtab = stretchers[0].id.replace(j_stretcher, j_display);
j_oldtab = document.getElementById(headtab);
j_oldtab.className = j_display + j_displayhover;
ja_Accord.clearAndToggle(stretchers[0]);
}For a random tab requested by Tomas, just replace stretchers[0] with stretchers[Math.floor(Math.random() * toggles.length)] and it’ll do the trick.
Regards,
Ha Le-Viet.October 17, 2006 at 3:01 am #211067You are a genius! Thank you so very much.
PamOctober 20, 2006 at 9:10 pm #211120It doesn´t work for me, when i parse the code into moo.fx.config.js, all the tabs show up in one.
Is this the right code?
<blockquote>function init(){
var stretchers = document.getElementsByClassName(j_stretcher); //div that stretches
var toggles = document.getElementsByClassName(j_display); //spans where I click on//accordion effect
var ja_Accord = new fx.Accordion(
toggles, stretchers, {opacity: j_opacity, duration: j_delay, transition: j_transition}
);ja_Accord.showThisHideOpen = function(toShow) {
this.elements.each(function(el, i) {
if (el.offsetHeight > 0 && el != toShow) this.clearAndToggle(el);
}.bind(this));
setTimeout(function(){this.clearAndToggle(toShow) ;}.bind(this), this.options.delay);
};headtab = stretchers[Math.floor(Math.random() * toggles.length)].id.replace(j_stretcher, j_display);
j_oldtab = document.getElementById(headtab);
j_oldtab.className = j_display + j_displayhover;
ja_Accord.clearAndToggle(stretchers[Math.floor(Math.random() * toggles.length)]);
}</blockquote>ha le-viet Developerha le-viet
- Join date:
- April 2006
- Posts:
- 415
- Downloads:
- 0
- Uploads:
- 26
- Thanked:
- 5 times in 1 posts
October 21, 2006 at 2:11 am #211130Oops, my bad…
It should be
function init(){
var stretchers = document.getElementsByClassName(j_stretcher); //div that stretches
var toggles = document.getElementsByClassName(j_display); //spans where I click on//accordion effect
var ja_Accord = new fx.Accordion(
toggles, stretchers, {opacity: j_opacity, duration: j_delay, transition: j_transition}
);ja_Accord.showThisHideOpen = function(toShow) {
this.elements.each(function(el, i) {
if (el.offsetHeight > 0 && el != toShow) this.clearAndToggle(el);
}.bind(this));
setTimeout(function(){this.clearAndToggle(toShow) ;}.bind(this), this.options.delay);
};randomid = Math.floor(Math.random() * toggles.length);
headtab = stretchers[randomid].id.replace(j_stretcher, j_display);
j_oldtab = document.getElementById(headtab);
j_oldtab.className = j_display + j_displayhover;
ja_Accord.clearAndToggle(stretchers[randomid]);
}Regards,
Ha Le-Viet.October 23, 2006 at 6:55 pm #211169Doesn´t work for me, all the tabs still show up in one.
ha le-viet Developerha le-viet
- Join date:
- April 2006
- Posts:
- 415
- Downloads:
- 0
- Uploads:
- 26
- Thanked:
- 5 times in 1 posts
October 24, 2006 at 2:05 am #211176Can I have your URL Tomas?
-
AuthorPosts
This topic contains 13 replies, has 3 voices, and was last updated by ha le-viet 18 years, 1 month ago.
We moved to new unified forum. Please post all new support queries in our New Forum