Tagged: horizontal gallery
-
AuthorPosts
-
October 28, 2019 at 4:02 pm #1151795
Hi guys,
I have a horizontal gallery element that i’d like to loop instead of having it stop at the last one. Is there anything I can add to child theme functions.php file to accomplish this? Thanks so much
October 29, 2019 at 9:36 am #1151997Hey bobfurgo,
Thank you for the inquiry.
Try to modify the config-templatebuilder > aviashortcodes > gallery_horizontal > gallery_horizontal.js file, look for the prev and next on click event listeners around line 134 and replace it with the following snippet.
prev.on('click', function(e) { if(currentIndex === false) currentIndex = 1; var index = currentIndex - 1; if(index < 0) index = slide_content.length - 1; change_active(index); }); next.on('click', function(e) { if(currentIndex === false) currentIndex = -1; var index = currentIndex + 1; if(index > slide_content.length - 1) index = slide_content.length - 1; if(currentIndex + 1 == slide_content.length) index = 0; change_active(index); });
Best regards,
IsmaelOctober 29, 2019 at 7:16 pm #1152125Thank you Ismael! Is there a way to do this within functions.php in child theme instead so when i update it, it doesn’t overwrite this snippet?
October 30, 2019 at 12:25 am #1152200Hi,
You can add the file to gallery_horizontal.js to your child theme to preserve the edits.
Best regards,
Jordan ShannonNovember 1, 2019 at 4:10 pm #1153079Thank you! I copied the gallery_horizontal.js to the child theme and it and replaced the code with the snippet above but it didn’t work, so I tried to replace it on the parent theme files as well and it didn’t work either. Any suggestions? Maybe it just needs to refresh? But I did open in an ingocnito window!
November 4, 2019 at 11:40 pm #1153789just following up, thanks! :)
November 8, 2019 at 3:59 am #1154823Hi,
Sorry for the delay. You can load the script from the child theme directory by using the wp_enqueue_script function, but you have to dequeue or deregister the original script (avia-module-gallery-hor) first.
// https://developer.wordpress.org/reference/functions/wp_enqueue_script/
// https://developer.wordpress.org/reference/functions/wp_dequeue_script/Best regards,
IsmaelNovember 20, 2019 at 9:37 pm #1158608Hi! Sorry, can you give just a little bit more direction on how to do that? :)
November 24, 2019 at 10:13 pm #1159695Hi,
Sorry for the late reply, I have tested this solution and it is working for me, so first please download a modified gallery_horizontal.js file in the Private Content area.
and then replace the one at \enfold\config-templatebuilder\avia-shortcodes\gallery_horizontal\gallery_horizontal.js
Please retain a backup of the old one.
Then you will need to clear your browser cache a few times for it to work, please also disable your Enfold Theme Options > Performance > JS & CSS file merging and compression and any cache plugin until it works.
Sorry, I was not able to deregister the original script.Best regards,
MikeDecember 12, 2019 at 12:14 am #1165021HI mike, thank you! I’ve done what you instructed and cleared the cache/opened in incognito but looks like it still isn’t working…it still could be the cache but i did check in multiple browsers. Could you take a look when you have a moment? Do you see it working on your end?
Also, if it ends up working, do i need to do this every time the theme is updated? or will it stay?
December 12, 2019 at 10:04 pm #1165353Hi,
You can put it on your child theme maybe, by removing the file from our main load and hook the JS through the functions.php file.
Best regards,
BasilisDecember 12, 2019 at 10:13 pm #1165356OK, thanks. Can you check to see if it’s working for you? i still don’t see it working on my end even though I did do as instructed. Thanks!
December 13, 2019 at 12:51 pm #1165504Hi,
Sorry, I couldn’t login to WP or your sftp, to take a closer look, please check.Best regards,
MikeDecember 13, 2019 at 5:23 pm #1165584Hi Mike! Please see private area. Thanks!
December 14, 2019 at 5:27 pm #1165905Hi,
Thank you for the logins, I uploaded the file I linked above to:\enfold\config-templatebuilder\avia-shortcodes\gallery_horizontal\gallery_horizontal.js
I left a copy of the original asgallery_horizontal.js.old
It is now working, please clear your browser cache and check.
As I wrote above I was not able to deregister the original script and add this to your child theme, so please follow this step again after your next update.
https://www.dropbox.com/s/xyvr4ub6aktg9p9/gallery_horizontal.js?dl=0
Best regards,
MikeDecember 14, 2019 at 5:54 pm #1165909ok, thank you very much!!!
So after an update, can you let me know what to do, step by step again? Sorry, just want to make sure I do it right since I wasn’t able to the first time. Thanks!
December 14, 2019 at 6:53 pm #1165917Hi,
Sure, 1: download the file, (I recommend you do that now and save it to your computer)
2: rename\enfold\config-templatebuilder\avia-shortcodes\gallery_horizontal\gallery_horizontal.js
togallery_horizontal.js.old
(as a backup)
3: upload the new file.
4: clear your browser and site cache.Best regards,
MikeDecember 21, 2019 at 5:53 pm #1168476Thank you so so much Mike!
December 22, 2019 at 6:13 pm #1168587Hi,
Glad we were able to help, we will close this now. Thank you for using Enfold.For your information, you can take a look at Enfold documentation here
For any other questions or issues, feel free to start new threads in the Enfold forum and we will gladly try to help you :)Best regards,
Mike -
AuthorPosts
- The topic ‘Horizontal Gallery loop’ is closed to new replies.