var docWidth = window.screen.width; alert(docWidth); var sizeDisplay = new Array(1024,1152,1366,1440,1680,1920,2560); var countSize = sizeDisplay.length; for(i=0; i<=countSize; i++){ if(docWidth==sizeDisplay[i]) break; $('.tttt').html(i); }