Viewing 19 posts - 1 through 19 (of 19 total)
  • Author
    Posts
  • #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

    #1151997

    Hey 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,
    Ismael

    #1152125

    Thank 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?

    #1152200

    Hi,

    You can add the file to gallery_horizontal.js to your child theme to preserve the edits.

    Best regards,
    Jordan Shannon

    #1153079

    Thank 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!

    #1153789

    just following up, thanks! :)

    #1154823

    Hi,

    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,
    Ismael

    #1158608

    Hi! Sorry, can you give just a little bit more direction on how to do that? :)

    #1159695

    Hi,
    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,
    Mike

    #1165021

    HI 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?

    #1165353

    Hi,

    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,
    Basilis

    #1165356

    OK, 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!

    #1165504

    Hi,
    Sorry, I couldn’t login to WP or your sftp, to take a closer look, please check.

    Best regards,
    Mike

    #1165584

    Hi Mike! Please see private area. Thanks!

    #1165905

    Hi,
    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 as gallery_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,
    Mike

    #1165909

    ok, 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!

    #1165917

    Hi,
    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 to gallery_horizontal.js.old (as a backup)
    3: upload the new file.
    4: clear your browser and site cache.

    Best regards,
    Mike

    #1168476

    Thank you so so much Mike!

    #1168587

    Hi,
    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

Viewing 19 posts - 1 through 19 (of 19 total)
  • The topic ‘Horizontal Gallery loop’ is closed to new replies.