I am trying to set the css left property value on items. Below is the code:
if (priorityObj.UpcomingActivities() != "") {
$.each(priorityObj.UpcomingActivities(), function (i, v) {
monthPosition = v.ActivityDateToDisplay().split(',')[0].substring(0, 3).trim();
if (monthPosition != "") {
activitymonthpos = $('#servicePlanMonths').find('#sp_month_' + monthPosition).position().left;
$(curelement).find('.priority-icon').offset({ left: activitymonthpos });
}
else {
monthLeftPosition = $('#servicePlanMonths').find('#sp_month_' + startingMonth).position().left;
$(curelement).find('.priority-icon').offset({ left: monthLeftPosition });
}
});
}
The monthPosition variable is used fetch the current month and based on this gets the css left property value and then apply that property value. This code is running fine. But the issue that I am facing is with
$(curelement).find('.priority-icon').offset({ left: monthLeftPosition });
Since this class is binded with the UpcomingActivities() function and this function can have more than two values. So, if I have two values, then it apply the css and set the same left property of [0] index for both the values. I wanted that it should set the left property on only one value and diff left property value on the other.
How can I make it work so that the left property of the css is applied on different items.
I know the problem is with the below statement but I couldn't find out how to resolve it
$(curelement).find('.priority-icon').offset({ left: monthLeftPosition });
Can anybody help?