I think the problem is in the first line:
a = $.cookie("col-layout");
Your rowCreation function treats a as a number, but the cookie passes it as a string. So when you do this,
for (var i = 0; i < divs.length; i += a) { divs.slice(i, i + a).wrapAll("<div class='row'></div>"); }
When i = 0,
You are asking for the array to be cut between 1 and "05" (concat i + "a"), this is fine because they exist. Therefore no problem.
When i = 5,
You request that the array be cut between 5 and "15" (concat i + "a"), so it removes all arrays and wraps them in one .row . That is why it is problematic for you.
Try to parse the resulting cookie "col-layout" variable of type Number , for example:
a = parseInt($.cookie("col-layout"), 10);
Read more about parseInt here.
krishgopinath Jul 06 '13 at 22:55 2013-07-06 22:55
source share