Hey, I was trying to override the main.min.js file in 'kalium/assets/js/'. I thought creating the same folder structure [ kalium-child/assets/js ] in my child theme and placing the file there should do the trick. However, if I inspect the page, and look for the loaded sources, only main.min.js from parent theme was loaded.
If I manually enqueue the script in the child themes functions.php only the script in child gets loaded, but throws an error: "If you must put scrollMonitor in the <head>, you must use jQuery.". Strangely other scripts from the parent theme also don't load if I enqueue the child script manually.
Could you tell me how I override the main.min.js file from my child theme? I need to change some lines for the portfolio-full-bg-slider.
Our main.min.js and other assets files are enqueued with assetsUrl function:
kalium()->assetsUrl( 'js/admin/main.min.js' );
So, this won't override child theme assets because main.min.js and other assets wrapped with this function are not intended to be overwritten for the main reason, after each update they contain new fixes and future updates will break theme functionality if its overidden. It will be up to your responsibility if you choose to overwrite this file and handle theme errors (if there are any). Here is how you can ignore the main.min.js of parent theme and include your modified one:
I know such files that are crucial for most the functions are not ment to be overwritten, however, I need to get that image switch event on portfolio-full-bg-slider with the active index to load information about the current image. I thought adding some lines where that event is actually defined would be the easiest way, also because I am not that advanced and this way I managed to achive what I needed.
If there is a better and relatively easy way to catch the switch, I would be happy if you let me know. It's more the event itself that is important than the index, because I can get that with the 'active' class on the current image.
Hey, I was trying to override the main.min.js file in 'kalium/assets/js/'. I thought creating the same folder structure [ kalium-child/assets/js ] in my child theme and placing the file there should do the trick. However, if I inspect the page, and look for the loaded sources, only main.min.js from parent theme was loaded.
If I manually enqueue the script in the child themes functions.php only the script in child gets loaded, but throws an error: "If you must put scrollMonitor in the <head>, you must use jQuery.". Strangely other scripts from the parent theme also don't load if I enqueue the child script manually.
Could you tell me how I override the main.min.js file from my child theme? I need to change some lines for the portfolio-full-bg-slider.
Thanks!
Hi JuliusNiedermeier,
Our main.min.js and other assets files are enqueued with assetsUrl function:
So, this won't override child theme assets because main.min.js and other assets wrapped with this function are not intended to be overwritten for the main reason, after each update they contain new fixes and future updates will break theme functionality if its overidden. It will be up to your responsibility if you choose to overwrite this file and handle theme errors (if there are any). Here is how you can ignore the main.min.js of parent theme and include your modified one:
This should do the work for you.
Thanks for the answer, works perfectly!
I know such files that are crucial for most the functions are not ment to be overwritten, however, I need to get that image switch event on portfolio-full-bg-slider with the active index to load information about the current image. I thought adding some lines where that event is actually defined would be the easiest way, also because I am not that advanced and this way I managed to achive what I needed.
If there is a better and relatively easy way to catch the switch, I would be happy if you let me know. It's more the event itself that is important than the index, because I can get that with the 'active' class on the current image.
But thanks anyway!
Hi JuliusNiedermeier,
I understand your point here. I have added the following hooks for portfolio full background slider:
(view large image)
So with the new version of Kalium (2.9.1) which will be released on Monday you can assign hooks for full background portfolio slider:
Does this work for you?That is great! Thank you very much!