I've had a good look but couldn't find exactly what I was looking for.
I have a starting var of var dsize = 6 and would like this value to change between various browser widths on resize. For all that responsive stuff you know.
The problem I face is that I only want to update the var and not the whole chunk of code that follows for performance.
$(window).on('load resize',function (){
var dsize = 6;
var wrapper = $('.clients-spec');
var ul;
if ($(window).width() >= 1200) {
var dsize = 6;
}
if ($(window).width() < 1200) {
var dsize = 5;
}
if ($(window).width() < 1000) {
var dsize = 4;
}
if ($(window).width() < 800) {
var dsize = 3;
}
if ($(window).width() < 600) {
var dsize = 2;
}...code...});
My deepest apologies if this is much simpler than I am making it, or has been asked multiple times and please point me in the right direction.
Cheers.
returnif any of the conditions are triggered