[Support request] Horizontal Scrollable Tab with Localstorage to Remember Tab Last Opened

Home Forums Support Horizontal Scrollable Tab with Localstorage to Remember Tab Last Opened

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #469791
    Cindy

    Hi. I am using a horizontal scrollable tabs at https://www.littlechinesereaders.com/courses/level-1-lessons/ and vertical tabs at https://www.littlechinesereaders.com/guided-courses/ with the following javascript in the GP footer hook. I’d like to have a way of remembering the user’s last visited tab (perhaps using localstorage) so that the same tab will load when the user revisits the page. How do I do that?

    function openCity(evt, cityName) {
    var i, tabcontent, tablinks;
    tabcontent = document.getElementsByClassName(“tabcontent”);
    for (i = 0; i < tabcontent.length; i++) {
    tabcontent.style.display = “none”;
    }
    tablinks = document.getElementsByClassName(“tablinks”);
    for (i = 0; i < tablinks.length; i++) {
    tablinks.className = tablinks.className.replace(” active”, “”);
    }
    document.getElementById(cityName).style.display = “block”;
    evt.currentTarget.className += ” active”;
    }
    document.getElementById(“defaultOpen”).click();

    GP Premium 1.5.6
    #469996
    Leo
    Staff
    Customer Support

    Hi there,

    This will likely require a custom solution which is out of the scope of this support forum.

    Have you checked with the source of the code and see if they might be able to help?

    If not perhaps ask on here: https://stackoverflow.com/

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.