test
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • Pam1234 Friend
    #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

    Pam1234 Friend
    #211049

    This is becoming an urgent issue. Is there anyone who can help? Thanks.
    Pam

    tomaspe Friend
    #211055

    Sorry 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 Developer
    #211059

    Hi 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.

    Pam1234 Friend
    #211060

    Hello 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,
    Pam

    ha le-viet Developer
    #211062

    Hi 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.

    Pam1234 Friend
    #211064

    Sent via PM. Thanks,
    Pam

    ha le-viet Developer
    #211065

    Finally 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.

    Pam1234 Friend
    #211067

    You are a genius! Thank you so very much.
    Pam

    tomaspe Friend
    #211120

    It 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 Developer
    #211130

    Oops, 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.

    tomaspe Friend
    #211169

    Doesn´t work for me, all the tabs still show up in one.

    ha le-viet Developer
    #211176

    Can I have your URL Tomas?

Viewing 13 posts - 1 through 13 (of 13 total)

This topic contains 13 replies, has 3 voices, and was last updated by  ha le-viet 18 years, 2 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum