-
AuthorPosts
-
December 20, 2016 at 5:34 pm #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
December 20, 2016 at 8:43 pm #726766Hi 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,
YigitDecember 21, 2016 at 12:52 pm #726988Hi 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
December 21, 2016 at 2:19 pm #727018Hi 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
December 21, 2016 at 2:33 pm #727031Hi Yigit,
What policy do you have on helping people… Everybody is being helped and all my issues are not being addressed …
regards
Pipinvest01December 21, 2016 at 8:02 pm #727265Hi,
@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.
January 4, 2017 at 11:29 am #729356Dear 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
January 5, 2017 at 5:45 pm #729974Hi,
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.
-
AuthorPosts
- You must be logged in to reply to this topic.