Hello, I´d like to ask for help for this:
The js/my_theme.js for a custom omega 5 subtheme is not loaded when it is modified.
I´m trying to add a jquery function to make a div change size when a button is clicked. I´m still begginer at javascript (and php) but I tried to add this code:
(function ($) {
"use strict";
Drupal.behaviors.customBehavior = {
// perform jQuery as normal in here
$(".boton-expander").click(function(){
var altura = $(".area-medios").css("height");
if (altura != "500px") {
$(".area-medios").css("height","500px");
} else {
$(".area-medios").css("height","100%");
}
});
};
})(jQuery);
to the javascript file in the js folder of the subtheme.
The problem is that when there is no custom code in the file (or when it is commented out), it loads correctly when I check in the debugger of firefox but when I make any change it doesn´t load anymore. I tried to put that function in the omega.js file, including the Drupal.behaviors.customBehavior = { ···functionhere··· }; and when I reload the page it stops loading the file as well. The same with the omega_starterkit.js. When they are default they work fine but with a modification they don´t show up anymore. I tried clearing caches but didn´t help. I checked the my_theme.libraries.yml file and all the names and paths and filenames are correct.
Is the code of the function I added wrong? or do you know if that is the reason for not working?
Sorry if it´s a very basic problem or not a bug in the theme. I´m still learning jquery and javascript, but thanks in advace for the help.
The website is in Drupal 8.1.0 and is using the Omega theme 8.x-5.0-alpha5 with very few extra modules (most relevant would be display suite, layout module, views slideshow...).
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commenteddjefte created an issue. See original summary.
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commented