Guest User

Untitled

a guest
Jan 21st, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. <script type="text/javascript" src="<? bloginfo('stylesheet_directory'); ?>/js/jquery.freetile.min.js"></script>
  2. <script>
  3. jQuery(document).ready(function() {
  4.  
  5. for (i=0;i<40;i++) {
  6. var w = 128 * (parseInt(Math.random() * 3) + 1) - 1,h = 128 * (parseInt(Math.random() * 3) + 1) - 1;
  7. jQuery('article').width(w).height(h);
  8. }
  9.  
  10. jQuery('#content').freetile();
  11. selector: 'article';
  12. animate: true;
  13. elementDelay: 10
  14. });
  15. </script>
  16.  
  17. for (i=0;i<40;i++) {
  18. var w = 128 * (parseInt(Math.random() * 3) + 1) - 1,h = 128 * (parseInt(Math.random() * 3) + 1) - 1;
  19. jQuery('article').width(w).height(h);
  20. }
  21.  
  22. for (i=0;i<40;i++) {
  23. var w = 64 * (parseInt(Math.random() * 3) + 1) - 1,
  24. h = 48 * (parseInt(Math.random() * 3) + 1) - 1;
  25.  
  26. //this part here is where the error happens.
  27. //you're asking to set the width and height to every element <content> on each iteration.
  28. //so on the last iteration, all the elements have the same width/height
  29. jQuery('content').width(w).height(h).appendTo('article');
  30. }
  31.  
  32. jQuery(document).ready(function() {
  33. for (i=0;i<40;i++) {
  34. var w = 64 * (parseInt(Math.random() * 3) + 1) - 1,
  35. h = 48 * (parseInt(Math.random() * 3) + 1) - 1;
  36. $('<div class="content" />').width(w).height(h).appendTo('body');
  37. }
  38. });
  39.  
  40. // What are you trying to set the width/height of?
  41. jQuery('').width(w).height(h)
  42.  
  43. jQuery('#content .selector-for-tiled-divs').width(w).height(h)...
Add Comment
Please, Sign In to add comment