I have this script and I want when window is only less than 768px
console.log('less than 768px');
but my script works always when window is more then 768px
please help me someone :(
var width = $(window).width();
$(window).on('resize',function(){
if (width < 768){
console.log('less than 768px');
}else{
console.log('nothing');
}
});