Okay
  Public Ticket #2083888
Problem with JS
Closed

Comments

  • JOSE started the conversation

    Hey! Got some rare problems with the theme, by itself, it works perfectly, but had some issues for me and I dont know how to fix them, for example, if I write an alert in js, it works, but if made an if declaration, it brokes. I tested the JS code in other webs and works fine, dont know why it fails here :(

    Or for example, I've installed "Snazzy maps" plugin, that works with JS to change the map theme, but dont work, but works well in other websites I've made.

    ¿Has this theme something that block JS?

    Hope you can help me, thank you in advice!

  •  1,974
    Support replied

    Hello Jose,

    it may be because AJAX loading, which in Grenda is true AJAX loading that means the page is not refreshed only the target page container is loaded, but by doing so any js initialization/code that usually is included in the header/footer are skipped.

    I think disabling AJAX in theme options would solve the problem.

    Thank you.

    Clapat Support

    https://www.clapat.com/

    Review Envato Item Support Policy

  • JOSE replied

    Hey! Tried before to disable AJAX loading and its the same, Could be something related to the child theme? I dont found any solution.

    Thank you in advice!

  •  1,974
    Support replied

    Do you get any errors in the browser's js console? what is the url of the page containing the Snazzy map?

    Thank you.

    Clapat Support

    https://www.clapat.com/

    Review Envato Item Support Policy

  • JOSE replied

    ¡Hey! Well, there's an error on the console, will send a gyazo for you to see it, I cant add attachments, its says "error server 0".


    Link to Gyazo


    So, as you see in the linked img, is there a file that is not linked?

    Hope this one solve the problem, thank you in advice!

  •  1,974
    Support replied

    What is the url of the page containing the Snazzy map?

    Thank you.

    Clapat Support

    https://www.clapat.com/

    Review Envato Item Support Policy

  • JOSE replied

    The url is this: https://www.martinezandion.com/contact/

    In the home page, there are 2 more errors, saying: "GET https://www.martinezandion.com/html/wp-content/themes/grenada-child net::ERR_ABORTED 404 (Not Found)"

    and on the index is marked with a cross: "

    <script type="text/javascript" src="/html/wp-content/themes/grenada-child"></script>
    <script type="text/javascript" src="/html/wp-content/themes/grenada-child"></script>

    "

    Thank you!

  •  1,974
    Support replied

    Hello Jose,

    your site is under construction can you send us wp admin access in a private comment?

    Thank you.

    Clapat Support

    https://www.clapat.com/

    Review Envato Item Support Policy

  • JOSE replied

    I disabled the underconstruction page !

  •  1,974
    Support replied

    Hi, i see two links to

    "/html/wp-content/themes/grenada-child"

    whic normally shouldn't be there

    https://d.pr/free/i/Rxs20c

    That's the reason for the errors in js console.

    Thank you.

    Clapat Support

    https://www.clapat.com/

    Review Envato Item Support Policy

  • JOSE replied

    Cool! I fixed it, but its seems that solve nothing, cant seen the fuzzy maps or use the javascript "IF sentence" :(

  •  1,974
    Support replied

    Where is actually this javascript IF sentence? - so we can debug it see why the code is not reached there.

    Thank you.

    Clapat Support

    https://www.clapat.com/

    Review Envato Item Support Policy

  • JOSE replied

    Hey! For example, this sentence dont work.

    $(window).on("scroll", function() {    if($(window).scrollTop() > 50) {        $("header").addClass("active");    } else {        //remove the background property so it comes transparent again (defined in your css)       $("header").removeClass("active");    }
    });
    
    $(function() {    $(window).on("scroll", function() {        if($(window).scrollTop() > 50) {            $(".header").addClass("active");        } else {            //remove the background property so it comes transparent again (defined in your css)           $(".header").removeClass("active");        }    });
    });

    Tried so many of them, and they work on other themes :(

    Even if i change the header tag for the class or id hosted on it(.classic-menu, #header-container), or even if i add the css instead of the class.

    But if i install the plugin "sticky menu(or anything) on scroll!" and add the classes to change the background color on scroll, it dont work :(


    Thank you in advice!

  •  1,974
    Support replied

    Have you tried disabling smooth scrolling in customizer -> general settings to see if you can catch the scroll event. Did you debug the code? Did you put a breakpoint inside of the event handler?

    I cannot debug it myself because of the under construction screen.

    Thank you.

    Clapat Support

    https://www.clapat.com/

    Review Envato Item Support Policy

  • JOSE replied

    Disabling the smooth scrolling dont work, the page is not under construction so you can see it, tried again the js and dont work.

    Thank you in advice!

  •  1,974
    Support replied

    Hello Jose,

    the code you mentioned is commented:

    https://d.pr/free/i/N4DCn6

    in any case to try inside of an event such as document ready

    $(document).ready(function() {

    ...

    }

    Thank you.

    Clapat Support

    https://www.clapat.com/

    Review Envato Item Support Policy

  • JOSE replied

    It seems that it worked now, tried a couple of js and its all good, could be smooth scrolling. Thank you!

  •  1,974
    Support replied

    Hi Jose, good to hear that.

    Thank you.

    Clapat Support

    https://www.clapat.com/

    Review Envato Item Support Policy