Window width and resize
<p>I would like to calculate the number of icons e.g. 50px depending on the width of the window for a menu.
So I started with:  </p>

<pre><code>$(window).width();
</code></pre>

<p>While loading the page with document ready function the width will be given. OK!</p>

<p>Now I would calculate the right amount of icons while resize the window. </p>

<p><code>$(window).resize(function() {
  //resize just happened, pixels changed
});</code></p>

<p>Tasks</p>

<ol>
<li>Initial width of the window -> if user is not resizing the window</li>
<li>Variable width of the window -> if user is resizing the window</li>
</ol>

<p>Each task is running but i don´t get it together.</p>

<p>Can u help me  --> THX!! </p>

<p>How can i calculate the number of icons with an initial width of the window and while resizing the window?</p>

<p>My Start:</p>

<pre><code>var activeItemcount; 

                checkWidth();
                $(window).resize(checkWidth);

                   function checkWidth() {
                        windowSize = $(window).width();
                      //   console.log(windowSize); 

                        var activeItemWidth = '100';                            // width of the icons
                        var maxWidth = windowSize;                              // max div width on screen 
                        activeItemcount = maxWidth / activeItemWidth;           // max icon with actual screen width
                        activeItemcount = Math.round(activeItemcount) -1;       // calculation
                           console.log(activeItemcount);


                   var i = '0'; 

                     $('.platform-view').each(function(){
                            if(i &lt; activeItemcount ){
                            $(this).wrapAll('&lt;div class="iconview-1"  /&gt;');
                            i++;
                            }else{  
                                $(this).wrapAll('&lt;div class="iconview-2" /&gt;');

                            }




                    });


                   };
</code></pre>
