Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #726690

    Dear supporter,

    On our website, I would like to make it possible for users to hover over an image with polly coordinates that will light up when hovering over. To make this possible, I need to add custom Javascript. I’ve been looking for a solution and bumped into several options. I’m wondering what the best solution is for us.

    Thanks in advance,

    Dear regards,

    Rachel

    #726766

    Hi Rachel!

    Please add following code to Functions.php file in Appearance > Editor

    function avia_my_custom_js_code(){
    if(is_page(5335)){
    ?>
    //YOUR CODE GOES HERE 
    <?php
    }}
    add_action('wp_footer', 'avia_my_custom_js_code');

    Regards,
    Yigit

    #726988

    Hi Yigit,

    Thank you for the code, I added the code and pasted my javascript code on the //your code goes here spot, but without a working result. Hopefully you can help with these last steps to get the Javascript working.

    Thanks in advance!

    Rachel

    #727018

    Hi Yigit,

    Update on above message; I deleted the Javascript code that I added to the function.php file; the code was seen in the socket (grey area on the bottom of the website) on the front end on the page…

    Regards,

    Rachel

    #727031

    Hi Yigit,

    What policy do you have on helping people… Everybody is being helped and all my issues are not being addressed …

    regards
    Pipinvest01

    #727265

    Hi,

    @rachelvanstaalduinen To add a jQuery script to any wordpress site

    1. Create your .js file with only the js code in the example.

    2. Add the css to Enfold > General Styling > Quick CSS

    3. Copy the html to a codeblock element on the page where you like to display.

    Then enqueue the scripts by adding the code provided in the below link to function.php :

    http://stackoverflow.com/questions/11159860/how-do-i-add-a-simple-jquery-script-to-wordpress

    @pipinvest01 we answer all tickets on first come first serve basis however some tickets may take longer because it needs to be researched kindly request you to be patient :)

    Best regards,
    Vinay

    • This reply was modified 7 years, 11 months ago by Vinay.
    #729356

    Dear Vinay,

    Thanks for the actionable help! I managed to walk successfully through step 1, 2 and 3. Unfortunately, I’m still having issues enqueue my diagnose.js file. I pasted the .js code into a my ‘zelfdiagnose.js’ file that is stored in the enfold-child theme folder /js. Exact location: /wp-content/themes/enfold-child/js

    The code I used in functions.php:

    add_action( ‘wp_enqueue_scripts’, ‘add_my_script’ );
    function add_my_script() {
    wp_register_script(
    ‘child-theme-script’,
    get_stylesheet_directory_uri() . ‘/www.hetrugcentrum.nl/wp-content/themes/enfold-child/js/zelfdiagnose.js’,
    array(‘jquery’)
    );

    wp_enqueue_script(‘child-theme-script’);
    }

    Still, no working link to my zelfdiagnose.js file. Hopefully you can help me solve this last issue. I also tried deleting the path ‘/www.hetrugcentrum.nl/wp-content/themes/enfold-child’ so that the path is ‘/js/zelfdiagnose.js’. Also no working result.

    Friendly regards,

    Rachel

    #729974

    Hi,

    Thank you for coming back.

    I checked the link above in private data and the js has been loaded.

    You have to use:

    
    
    get_stylesheet_directory_uri() . ‘/js/zelfdiagnose.js’,
    
    

    Maybe you forgot to clear the browser cache before loading the page – in this case you get the cached page.

    Best regards,
    Günter

    • This reply was modified 7 years, 10 months ago by Günter.
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.