The forum of the forums

Would you like to react to this message? Create an account in a few clicks or log in to continue.
The forum of the forums
3 posters

    Optimize my JavaScript

    Leiva
    Leiva
    New Member


    Posts : 5
    Reputation : 1
    Language : English, Spanish

    Solved Optimize my JavaScript

    Post by Leiva December 7th 2020, 1:30 pm

    Technical Details


    Forum version : #phpBB3
    Position : Founder
    Concerned browser(s) : Google Chrome
    Who the problem concerns : All members
    When the problem appeared : In a HTML page
    Forum link : ( link is hidden, you must reply to see )

    Description of problem

    I have a problem with my forum's JavaScript. When I refresh the page the forum takes one or two seconds charging the code.

    I mean, for example, I have this code:
    Code:
    $(function(){
        if(_userdata["session_logged_in"] == 0){
            $('#natthome:contains(Home)').remove();
        }
    else {
            $('div#menuWrapper li:contains(Registrarse)').remove();
        }
    });

    This code removes a word from the navbar for the connected members. Only no-register members can see that word. But... when I am log in and i refresh the forum I see that word, one second, and then the JavaScript works and remove it.

    I would like to know if there is any way of optimizing my JavaScript to avoid that annoying second.

    ¡Thanks!
    TheCrow
    TheCrow
    Manager
    Manager


    Male Posts : 6916
    Reputation : 795
    Language : Greek, English

    Solved Re: Optimize my JavaScript

    Post by TheCrow December 7th 2020, 1:33 pm

    Hello,

    So you want that word "Home" not to appear for that split second right?



    Optimize my JavaScript Thecro10
     Forum of the Forums

    Forumotion Rules | Tips & Tricks |
    FAQ | Did you forget your password?



    *** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
    No support via PM!
    Leiva
    Leiva
    New Member


    Posts : 5
    Reputation : 1
    Language : English, Spanish

    Solved Re: Optimize my JavaScript

    Post by Leiva December 8th 2020, 10:11 am

    Yes. In that case, and in with other codes.
    Leiva
    Leiva
    New Member


    Posts : 5
    Reputation : 1
    Language : English, Spanish

    Solved Re: Optimize my JavaScript

    Post by Leiva December 13th 2020, 10:29 am

    hello Optimize my JavaScript 1f613 Optimize my JavaScript 1f614
    TheCrow
    TheCrow
    Manager
    Manager


    Male Posts : 6916
    Reputation : 795
    Language : Greek, English

    Solved Re: Optimize my JavaScript

    Post by TheCrow December 13th 2020, 12:01 pm

    Hello,

    I suggest you revert your codes. Meaning, you should hide the Home button for everyone, and only show it to the guests. Therefore when you're logged in you won't see that button at all.

    Regards,
    TC.



    Optimize my JavaScript Thecro10
     Forum of the Forums

    Forumotion Rules | Tips & Tricks |
    FAQ | Did you forget your password?



    *** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
    No support via PM!
    skouliki
    skouliki
    Manager
    Manager


    Female Posts : 15391
    Reputation : 1709
    Language : English,Greek
    Location : Greece

    Solved Re: Optimize my JavaScript

    Post by skouliki December 17th 2020, 9:01 am

    hello

    is this solved ?


    Leiva
    Leiva
    New Member


    Posts : 5
    Reputation : 1
    Language : English, Spanish

    Solved Re: Optimize my JavaScript

    Post by Leiva December 17th 2020, 9:16 am

    TheCrow wrote:Hello,

    I suggest you revert your codes. Meaning, you should hide the Home button for everyone, and only show it to the guests. Therefore when you're logged in you won't see that button at all.

    Regards,
    TC.
    Hello! Well, but this doesn't solve my problem. I have other codes and I want to split that second in all mi JavaScript
    TheCrow
    TheCrow
    Manager
    Manager


    Male Posts : 6916
    Reputation : 795
    Language : Greek, English

    Solved Re: Optimize my JavaScript

    Post by TheCrow December 17th 2020, 9:40 am

    @Leiva, that split second is for the javascripts to load. Have you considered adding a loading page to your forum so the javascripts will work and then show the forum? That would do the trick.



    Optimize my JavaScript Thecro10
     Forum of the Forums

    Forumotion Rules | Tips & Tricks |
    FAQ | Did you forget your password?



    *** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
    No support via PM!
    Leiva
    Leiva
    New Member


    Posts : 5
    Reputation : 1
    Language : English, Spanish

    Solved Re: Optimize my JavaScript

    Post by Leiva December 19th 2020, 5:29 pm

    TheCrow wrote:@Leiva, that split second is for the javascripts to load. Have you considered adding a loading page to your forum so the javascripts will work and then show the forum? That would do the trick.
    Well, that's a good idea. Thanks! Solved.
    skouliki
    skouliki
    Manager
    Manager


    Female Posts : 15391
    Reputation : 1709
    Language : English,Greek
    Location : Greece

    Solved Re: Optimize my JavaScript

    Post by skouliki December 19th 2020, 7:01 pm

    Problem solved & topic archived.
    Please read our forum rules: ESF General Rules


      Current date/time is November 13th 2024, 6:50 pm