I have a question regarding the width of my element that I want to divide by 90. If this width is a multiple of 90, I set the width of the element. If not, I move on to the next.
For example, when the window width is 1000px and the element is at full width (let's call it EW for element width), if EW can be divided by 90, then it is ok. So, 1000/90 = 11.1(1). As we make the window smaller, we reach 990/90 = 10, which is also okay.
Check out this CODEPEN for an example.
The code works when you resize slowly, but it gets lost when you do it quickly.
var windowWidth = $(window).width(),
widthNumber = windowWidth / 90;
$("#EW").css({
width: windowWidth
});
if(widthNumber % 1 != 0){
console.log("don't change")
} else {
console.log("change")
}
Does anyone have any ideas on how to solve this issue?