My goal is to assign properties to a class and then inherit them into individual DIV IDs. However, something seems to be off with my code. What could it be?
var startItem1X = randomRange(50,100);
var startItem1Y = randomRange(50,100);
var startItem2X = randomRange(50,100);
var startItem2Y = randomRange(50,100);
var startItem3X = randomRange(50,100);
var startItem3Y = randomRange(50,100);
var startmyClassX = randomRange(50,100);
var startmyClassY = randomRange(50,100);
$(".myClass").css(randomRange(50,100)); // Apply properties to the Class.
How can I incorporate these properties into the class successfully?
function runItem1() {
/* Randomize starting position by adjusting css */
$("#item1").css("left", startItem1X + "px");
$("#item1").css("top", startItem1Y + "px");
/* Cycle1 and Cycle2 variables enable an infinite loop */
(cycle1 = function() {
var m = randomRange(50,100);
var n = randomRange(75,150);
item1.animate({left:'+='+n},2000);
item1.animate({left:'+='+m, top:'+='+m}, 2000)
item1.animate({left:'-='+m, top:'+='+m}, 2000)
item1.animate({left:'-='+n},2000);
item1.animate({top:'-='+n},2000,cycle1)
})();
}