0
The HTML of my slide show is that I want you to change the style="width" every time you change the device size.
<div class="leftside">
    <div class="slideshow" id="slideshow">
        <div class="slideshowarea">
            <div class="slide">.</div>
            <div class="slide">.</div>
            <div class="slide">.</div>
            <div class="slide">.</div>
        </div>
    </div>
</div>
The CSS
.slideshow{
     height: 335px;
     background-color: #CCC;
     overflow: hidden;
}
.slideshowarea{
    width: 100000px;
    height: 335px;
    background-color: #DDD;
}
.slide{
    height: 335px;
    float: left;
}
Fis this script to grab the width and then set on all slides but is returning me error;
window.onload = function() {
    var slidewidth = document.getElementById('slideshow').offsetWidth;
    var objs = document.getElementsByClassName("slide");
    for (var i in objs) {
        objs[i].style.width = slidewidth;
    }
}
But it’s returning to me that mistake :
script.js:9 Uncaught TypeError: Cannot set property 'width' of undefined at window.onload (script.js:9) window.onload @ script.js:9
I’m beginner in the area, I’ve searched and I’ve tried a lot about it, I hope you can help me, it’s complicated the business.
Personal vlw for the answers I was able to solve by putting .. if(!isNaN(i)) objs[i].style.width = slidewidth+"px"; let’s study more on the subject;;
– Giliard Beda