I asked a question a few days ago about getting the height of images to adjust in Slideshow along with the width. Unfortunately, I received no responses.
So, I went about writing some JavaScript that adjusts images in a page the way I would like the images in Slideshow to be adjusted. The code works fine on regular Drupal pages, but does not work for the images in Slideshow.
Does anyone know how to get the JavaScript to work for the images in the Slideshow? I should state that I am brand new to coding and JavaScript, so there may be some issues with the code below, but it does work.
Here is the JavaScript code:
function myFunction() {
var x = document.getElementsByClassName("slide");
for (i = 0; i < x.length; i++) {
var viewHeight = window.innerHeight;
var viewWidth = window.innerWidth;
var viewAspect = viewWidth / viewHeight;
var imageHeight = x[i].height;
var imageWidth = x[i].width;
var imageAspect = imageWidth / imageHeight;
if (imageAspect < viewAspect) {
x[i].style.height = viewHeight + "px";
}
else {
x[i].style.width = viewWidth + "px";
}
}
}
window.onload = function() {
myFunction();
};
window.onresize = function() {
myFunction();
};