Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It is hard to see what exactly you're doing wrong with your <code>runCSStweaks()</code> function because we can't see your HTML or how you're calling it. You can see in <a href="http://jsfiddle.net/jfriend00/kk2U9/" rel="nofollow">my working demo</a> that the code works fine and populates the <code>item</code> array just fine when nothing else is wrong:</p> <pre><code>var item = []; function runCSStweaks() { $('.jp-playlist li').each(function() { var min = -90; var max = 90; var random = Math.floor(Math.random() * (max - min + 1)) + min; item.push(random); $(this).css('-webkit-transform','rotate('+ random +'deg)') }); }; runCSStweaks(); </code></pre> <p>Working demo: <a href="http://jsfiddle.net/jfriend00/kk2U9/" rel="nofollow">http://jsfiddle.net/jfriend00/kk2U9/</a> that shows the <code>item</code> array fully populated with random numbers.</p> <p>I've exaggerated the rotation just for visual clarify. The possibilities in your own code/HTML I can think of are:</p> <ol> <li>The selector <code>'.jp-playlist li'</code> isn't matching anything because that isn't the right selector for your HTML.</li> <li>You're calling this code before the page has been loaded so <code>.jp-playlist</code> isn't found.</li> <li>You're calling this code before the <code>.jp-playlist</code> and <code>li</code> elements have been created (if they are created in code or loaded dynamically after page load).</li> <li>You're getting confused because there's no <code>item[0]</code> element in your code that way you are populating that array (that's why I used <code>.push()</code> in my code).</li> <li>You aren't calling <code>runCSStweaks()</code>.</li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload