Javascript/jQuery Maths Logic
up vote
0
down vote
favorite
I have written a script for a flexbox grid functionality, however I am having some issues with the maths calculations to find out how many items are on the last row as I wish to apply a class to them in order to fix flexbox styling in the case it's not a full row.
My situation:
I have 4 layouts: 1 Column, 2 Column, 3 Column and 4 Columns.
In different cases I would have the following situation:
- For 4 Column layout there may be 3 remaining on the bottom row.
- For 4 Column layout there may be 2 remaining on the bottom row.
- For 4 Column layout there may be 1 remaining on the bottom row.
- For 3 Column layout there may be 2 remaining on the bottom row.
- For 3 Column layout there may be 1 remaining on the bottom row.
- For 2 Column layout there may be 1 remaining on the bottom row.
In each of these circumstances I need to add different classes to the items remaining on the bottom row, these classes being:
- flex-last (for the last/singular item left on a row)
- flex-second-last (for the 2nd to last item on a row)
- flex-third-last (for the 3rd to last item on a row)
These classes must only be applied if the row is not full e.g. if there is 4 items on the bottom row for 4 column, nothing should be applied as no styling fixes are required.
My current code was working fine however I have run into an instance where I have 43 items in the grid and the maths seems to have issues.
As the screensize gets smaller it corrects the layout to be smaller and smaller until its 1 column, this means that the calculations must work in all cases.
Below is my code:
jQuery(document).ready(function($) {
$(".flex-container").each(function() {
var flexColumns = $(this).attr("rel");
var self = $(this);
function flexboxFixes(){
if(self.find(".flex-item").hasClass("flex-cols-3")) {
var flexItemCount = self.find('.flex-cols-3').length;
if ((flexItemCount - 1) % 3 === 0) {
self.find(".flex-cols-3:last-of-type").addClass("flex-last");
} else if ((flexItemCount - 1) % 3 !== 0 && flexItemCount % 3 !== 0 ) {
self.find(".flex-cols-3:last-of-type").addClass("flex-last");
self.find(".flex-cols-3:nth-last-of-type(2)").addClass("flex-second-last");
}
} else if(self.find(".flex-item").hasClass("flex-cols-4")) {
var flexItemCount = self.find('.flex-cols-4').length;
if ((flexItemCount - 1) % 4 === 0) {
self.find(".flex-cols-4:last-of-type").addClass("flex-last");
} else if ((flexItemCount - 2) % 4 === 0) {
self.find(".flex-cols-4:last-of-type").addClass("flex-last");
self.find(".flex-cols-4:nth-last-of-type(2)").addClass("flex-second-last");
} else if ((flexItemCount - 2) % 4 !== 0 && flexItemCount % 4 !== 0) {
self.find(".flex-cols-4:last-of-type").addClass("flex-last");
self.find(".flex-cols-4:nth-last-of-type(2)").addClass("flex-second-last");
self.find(".flex-cols-4:nth-last-of-type(3)").addClass("flex-third-last");
}
} else if(self.find(".flex-item").hasClass("flex-cols-2")) {
var flexItemCount = self.find('.flex-cols-2').length;
if ((flexItemCount - 1) % 2 === 0) { //Is there 1 extra?
self.find(".flex-cols-2:last-of-type").addClass("flex-last");
}
}
}
flexboxFixes();
$(window).bind('resize',function(){flexboxFixes();});
});
});
Notes worth noting:
These might help you figure out how we can do the maths without conflict?
- X / 1 Always Equals whole number
- X / 2 Always Equals whole number or .5
- X / 3 Always Equals whole number or .33 or .66
X / 4 Always Equals whole number or .25 or .5 or .75
Whole Number never Decimal = full row
- 2 col, .5 = 1 left over
- 3 col, .33 = 1 left over, .66 = 2 left over
- 4 col, .25 = 1 left over, .5 = 2 left over, .75 = 3 left over
I am thinking something along the lines of first checking the layout, then checking the decimal values to see how many items remain as this will be the same across all numbers?
var flexItemCount = self.find('.flex-cols-4').length;
var flexItemMath = flexItemCount / 4;
alert(flexItemMath % 1);
if (flexItemMath % columnCount) == 0.X
would this seem feasible?
javascript jquery flexbox
add a comment |
up vote
0
down vote
favorite
I have written a script for a flexbox grid functionality, however I am having some issues with the maths calculations to find out how many items are on the last row as I wish to apply a class to them in order to fix flexbox styling in the case it's not a full row.
My situation:
I have 4 layouts: 1 Column, 2 Column, 3 Column and 4 Columns.
In different cases I would have the following situation:
- For 4 Column layout there may be 3 remaining on the bottom row.
- For 4 Column layout there may be 2 remaining on the bottom row.
- For 4 Column layout there may be 1 remaining on the bottom row.
- For 3 Column layout there may be 2 remaining on the bottom row.
- For 3 Column layout there may be 1 remaining on the bottom row.
- For 2 Column layout there may be 1 remaining on the bottom row.
In each of these circumstances I need to add different classes to the items remaining on the bottom row, these classes being:
- flex-last (for the last/singular item left on a row)
- flex-second-last (for the 2nd to last item on a row)
- flex-third-last (for the 3rd to last item on a row)
These classes must only be applied if the row is not full e.g. if there is 4 items on the bottom row for 4 column, nothing should be applied as no styling fixes are required.
My current code was working fine however I have run into an instance where I have 43 items in the grid and the maths seems to have issues.
As the screensize gets smaller it corrects the layout to be smaller and smaller until its 1 column, this means that the calculations must work in all cases.
Below is my code:
jQuery(document).ready(function($) {
$(".flex-container").each(function() {
var flexColumns = $(this).attr("rel");
var self = $(this);
function flexboxFixes(){
if(self.find(".flex-item").hasClass("flex-cols-3")) {
var flexItemCount = self.find('.flex-cols-3').length;
if ((flexItemCount - 1) % 3 === 0) {
self.find(".flex-cols-3:last-of-type").addClass("flex-last");
} else if ((flexItemCount - 1) % 3 !== 0 && flexItemCount % 3 !== 0 ) {
self.find(".flex-cols-3:last-of-type").addClass("flex-last");
self.find(".flex-cols-3:nth-last-of-type(2)").addClass("flex-second-last");
}
} else if(self.find(".flex-item").hasClass("flex-cols-4")) {
var flexItemCount = self.find('.flex-cols-4').length;
if ((flexItemCount - 1) % 4 === 0) {
self.find(".flex-cols-4:last-of-type").addClass("flex-last");
} else if ((flexItemCount - 2) % 4 === 0) {
self.find(".flex-cols-4:last-of-type").addClass("flex-last");
self.find(".flex-cols-4:nth-last-of-type(2)").addClass("flex-second-last");
} else if ((flexItemCount - 2) % 4 !== 0 && flexItemCount % 4 !== 0) {
self.find(".flex-cols-4:last-of-type").addClass("flex-last");
self.find(".flex-cols-4:nth-last-of-type(2)").addClass("flex-second-last");
self.find(".flex-cols-4:nth-last-of-type(3)").addClass("flex-third-last");
}
} else if(self.find(".flex-item").hasClass("flex-cols-2")) {
var flexItemCount = self.find('.flex-cols-2').length;
if ((flexItemCount - 1) % 2 === 0) { //Is there 1 extra?
self.find(".flex-cols-2:last-of-type").addClass("flex-last");
}
}
}
flexboxFixes();
$(window).bind('resize',function(){flexboxFixes();});
});
});
Notes worth noting:
These might help you figure out how we can do the maths without conflict?
- X / 1 Always Equals whole number
- X / 2 Always Equals whole number or .5
- X / 3 Always Equals whole number or .33 or .66
X / 4 Always Equals whole number or .25 or .5 or .75
Whole Number never Decimal = full row
- 2 col, .5 = 1 left over
- 3 col, .33 = 1 left over, .66 = 2 left over
- 4 col, .25 = 1 left over, .5 = 2 left over, .75 = 3 left over
I am thinking something along the lines of first checking the layout, then checking the decimal values to see how many items remain as this will be the same across all numbers?
var flexItemCount = self.find('.flex-cols-4').length;
var flexItemMath = flexItemCount / 4;
alert(flexItemMath % 1);
if (flexItemMath % columnCount) == 0.X
would this seem feasible?
javascript jquery flexbox
what exactly is happening, when you have 43 elements?
– errand
Nov 22 at 11:50
with 43 elements in a 4 col layout it does not add "flex-last" to the last element instead it adds "flex-second-last" the item prior it adds "flex-third-last" leaving the actual 3rd last without a class causing styles to break.
– Daniel Vickers
Nov 22 at 11:52
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have written a script for a flexbox grid functionality, however I am having some issues with the maths calculations to find out how many items are on the last row as I wish to apply a class to them in order to fix flexbox styling in the case it's not a full row.
My situation:
I have 4 layouts: 1 Column, 2 Column, 3 Column and 4 Columns.
In different cases I would have the following situation:
- For 4 Column layout there may be 3 remaining on the bottom row.
- For 4 Column layout there may be 2 remaining on the bottom row.
- For 4 Column layout there may be 1 remaining on the bottom row.
- For 3 Column layout there may be 2 remaining on the bottom row.
- For 3 Column layout there may be 1 remaining on the bottom row.
- For 2 Column layout there may be 1 remaining on the bottom row.
In each of these circumstances I need to add different classes to the items remaining on the bottom row, these classes being:
- flex-last (for the last/singular item left on a row)
- flex-second-last (for the 2nd to last item on a row)
- flex-third-last (for the 3rd to last item on a row)
These classes must only be applied if the row is not full e.g. if there is 4 items on the bottom row for 4 column, nothing should be applied as no styling fixes are required.
My current code was working fine however I have run into an instance where I have 43 items in the grid and the maths seems to have issues.
As the screensize gets smaller it corrects the layout to be smaller and smaller until its 1 column, this means that the calculations must work in all cases.
Below is my code:
jQuery(document).ready(function($) {
$(".flex-container").each(function() {
var flexColumns = $(this).attr("rel");
var self = $(this);
function flexboxFixes(){
if(self.find(".flex-item").hasClass("flex-cols-3")) {
var flexItemCount = self.find('.flex-cols-3').length;
if ((flexItemCount - 1) % 3 === 0) {
self.find(".flex-cols-3:last-of-type").addClass("flex-last");
} else if ((flexItemCount - 1) % 3 !== 0 && flexItemCount % 3 !== 0 ) {
self.find(".flex-cols-3:last-of-type").addClass("flex-last");
self.find(".flex-cols-3:nth-last-of-type(2)").addClass("flex-second-last");
}
} else if(self.find(".flex-item").hasClass("flex-cols-4")) {
var flexItemCount = self.find('.flex-cols-4').length;
if ((flexItemCount - 1) % 4 === 0) {
self.find(".flex-cols-4:last-of-type").addClass("flex-last");
} else if ((flexItemCount - 2) % 4 === 0) {
self.find(".flex-cols-4:last-of-type").addClass("flex-last");
self.find(".flex-cols-4:nth-last-of-type(2)").addClass("flex-second-last");
} else if ((flexItemCount - 2) % 4 !== 0 && flexItemCount % 4 !== 0) {
self.find(".flex-cols-4:last-of-type").addClass("flex-last");
self.find(".flex-cols-4:nth-last-of-type(2)").addClass("flex-second-last");
self.find(".flex-cols-4:nth-last-of-type(3)").addClass("flex-third-last");
}
} else if(self.find(".flex-item").hasClass("flex-cols-2")) {
var flexItemCount = self.find('.flex-cols-2').length;
if ((flexItemCount - 1) % 2 === 0) { //Is there 1 extra?
self.find(".flex-cols-2:last-of-type").addClass("flex-last");
}
}
}
flexboxFixes();
$(window).bind('resize',function(){flexboxFixes();});
});
});
Notes worth noting:
These might help you figure out how we can do the maths without conflict?
- X / 1 Always Equals whole number
- X / 2 Always Equals whole number or .5
- X / 3 Always Equals whole number or .33 or .66
X / 4 Always Equals whole number or .25 or .5 or .75
Whole Number never Decimal = full row
- 2 col, .5 = 1 left over
- 3 col, .33 = 1 left over, .66 = 2 left over
- 4 col, .25 = 1 left over, .5 = 2 left over, .75 = 3 left over
I am thinking something along the lines of first checking the layout, then checking the decimal values to see how many items remain as this will be the same across all numbers?
var flexItemCount = self.find('.flex-cols-4').length;
var flexItemMath = flexItemCount / 4;
alert(flexItemMath % 1);
if (flexItemMath % columnCount) == 0.X
would this seem feasible?
javascript jquery flexbox
I have written a script for a flexbox grid functionality, however I am having some issues with the maths calculations to find out how many items are on the last row as I wish to apply a class to them in order to fix flexbox styling in the case it's not a full row.
My situation:
I have 4 layouts: 1 Column, 2 Column, 3 Column and 4 Columns.
In different cases I would have the following situation:
- For 4 Column layout there may be 3 remaining on the bottom row.
- For 4 Column layout there may be 2 remaining on the bottom row.
- For 4 Column layout there may be 1 remaining on the bottom row.
- For 3 Column layout there may be 2 remaining on the bottom row.
- For 3 Column layout there may be 1 remaining on the bottom row.
- For 2 Column layout there may be 1 remaining on the bottom row.
In each of these circumstances I need to add different classes to the items remaining on the bottom row, these classes being:
- flex-last (for the last/singular item left on a row)
- flex-second-last (for the 2nd to last item on a row)
- flex-third-last (for the 3rd to last item on a row)
These classes must only be applied if the row is not full e.g. if there is 4 items on the bottom row for 4 column, nothing should be applied as no styling fixes are required.
My current code was working fine however I have run into an instance where I have 43 items in the grid and the maths seems to have issues.
As the screensize gets smaller it corrects the layout to be smaller and smaller until its 1 column, this means that the calculations must work in all cases.
Below is my code:
jQuery(document).ready(function($) {
$(".flex-container").each(function() {
var flexColumns = $(this).attr("rel");
var self = $(this);
function flexboxFixes(){
if(self.find(".flex-item").hasClass("flex-cols-3")) {
var flexItemCount = self.find('.flex-cols-3').length;
if ((flexItemCount - 1) % 3 === 0) {
self.find(".flex-cols-3:last-of-type").addClass("flex-last");
} else if ((flexItemCount - 1) % 3 !== 0 && flexItemCount % 3 !== 0 ) {
self.find(".flex-cols-3:last-of-type").addClass("flex-last");
self.find(".flex-cols-3:nth-last-of-type(2)").addClass("flex-second-last");
}
} else if(self.find(".flex-item").hasClass("flex-cols-4")) {
var flexItemCount = self.find('.flex-cols-4').length;
if ((flexItemCount - 1) % 4 === 0) {
self.find(".flex-cols-4:last-of-type").addClass("flex-last");
} else if ((flexItemCount - 2) % 4 === 0) {
self.find(".flex-cols-4:last-of-type").addClass("flex-last");
self.find(".flex-cols-4:nth-last-of-type(2)").addClass("flex-second-last");
} else if ((flexItemCount - 2) % 4 !== 0 && flexItemCount % 4 !== 0) {
self.find(".flex-cols-4:last-of-type").addClass("flex-last");
self.find(".flex-cols-4:nth-last-of-type(2)").addClass("flex-second-last");
self.find(".flex-cols-4:nth-last-of-type(3)").addClass("flex-third-last");
}
} else if(self.find(".flex-item").hasClass("flex-cols-2")) {
var flexItemCount = self.find('.flex-cols-2').length;
if ((flexItemCount - 1) % 2 === 0) { //Is there 1 extra?
self.find(".flex-cols-2:last-of-type").addClass("flex-last");
}
}
}
flexboxFixes();
$(window).bind('resize',function(){flexboxFixes();});
});
});
Notes worth noting:
These might help you figure out how we can do the maths without conflict?
- X / 1 Always Equals whole number
- X / 2 Always Equals whole number or .5
- X / 3 Always Equals whole number or .33 or .66
X / 4 Always Equals whole number or .25 or .5 or .75
Whole Number never Decimal = full row
- 2 col, .5 = 1 left over
- 3 col, .33 = 1 left over, .66 = 2 left over
- 4 col, .25 = 1 left over, .5 = 2 left over, .75 = 3 left over
I am thinking something along the lines of first checking the layout, then checking the decimal values to see how many items remain as this will be the same across all numbers?
var flexItemCount = self.find('.flex-cols-4').length;
var flexItemMath = flexItemCount / 4;
alert(flexItemMath % 1);
if (flexItemMath % columnCount) == 0.X
would this seem feasible?
javascript jquery flexbox
javascript jquery flexbox
edited Nov 22 at 12:01
DestinatioN
1,2521326
1,2521326
asked Nov 22 at 11:38
Daniel Vickers
354215
354215
what exactly is happening, when you have 43 elements?
– errand
Nov 22 at 11:50
with 43 elements in a 4 col layout it does not add "flex-last" to the last element instead it adds "flex-second-last" the item prior it adds "flex-third-last" leaving the actual 3rd last without a class causing styles to break.
– Daniel Vickers
Nov 22 at 11:52
add a comment |
what exactly is happening, when you have 43 elements?
– errand
Nov 22 at 11:50
with 43 elements in a 4 col layout it does not add "flex-last" to the last element instead it adds "flex-second-last" the item prior it adds "flex-third-last" leaving the actual 3rd last without a class causing styles to break.
– Daniel Vickers
Nov 22 at 11:52
what exactly is happening, when you have 43 elements?
– errand
Nov 22 at 11:50
what exactly is happening, when you have 43 elements?
– errand
Nov 22 at 11:50
with 43 elements in a 4 col layout it does not add "flex-last" to the last element instead it adds "flex-second-last" the item prior it adds "flex-third-last" leaving the actual 3rd last without a class causing styles to break.
– Daniel Vickers
Nov 22 at 11:52
with 43 elements in a 4 col layout it does not add "flex-last" to the last element instead it adds "flex-second-last" the item prior it adds "flex-third-last" leaving the actual 3rd last without a class causing styles to break.
– Daniel Vickers
Nov 22 at 11:52
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
After previously overthinking the whole think I discovered a simple answer, the answer checks the decimal value for the certain column layout when divided by amount of columns.
if(self.find(".flex-item").hasClass("flex-cols-3")) {
var flexItemCount = self.find('.flex-cols-3').length;
var flexItemMath = flexItemCount / 3; //NEW
flexItemMath = flexItemMath % 1; //NEW
var flexItemRound = Number(flexItemMath).toFixed(2); //NEW
if (flexItemRound == 0.00) { //NEW
} else if (flexItemRound == 0.33) { //NEW
self.find(".flex-cols-3:last-of-type").addClass("flex-last");//1 remainder 0.33
} else if (flexItemRound == 0.66) { //NEW
self.find(".flex-cols-3:last-of-type").addClass("flex-last");
self.find(".flex-cols-3:nth-last-of-type(2)").addClass("flex-second-last"); //2 remainder 0.66
}
}
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53430165%2fjavascript-jquery-maths-logic%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
After previously overthinking the whole think I discovered a simple answer, the answer checks the decimal value for the certain column layout when divided by amount of columns.
if(self.find(".flex-item").hasClass("flex-cols-3")) {
var flexItemCount = self.find('.flex-cols-3').length;
var flexItemMath = flexItemCount / 3; //NEW
flexItemMath = flexItemMath % 1; //NEW
var flexItemRound = Number(flexItemMath).toFixed(2); //NEW
if (flexItemRound == 0.00) { //NEW
} else if (flexItemRound == 0.33) { //NEW
self.find(".flex-cols-3:last-of-type").addClass("flex-last");//1 remainder 0.33
} else if (flexItemRound == 0.66) { //NEW
self.find(".flex-cols-3:last-of-type").addClass("flex-last");
self.find(".flex-cols-3:nth-last-of-type(2)").addClass("flex-second-last"); //2 remainder 0.66
}
}
add a comment |
up vote
0
down vote
accepted
After previously overthinking the whole think I discovered a simple answer, the answer checks the decimal value for the certain column layout when divided by amount of columns.
if(self.find(".flex-item").hasClass("flex-cols-3")) {
var flexItemCount = self.find('.flex-cols-3').length;
var flexItemMath = flexItemCount / 3; //NEW
flexItemMath = flexItemMath % 1; //NEW
var flexItemRound = Number(flexItemMath).toFixed(2); //NEW
if (flexItemRound == 0.00) { //NEW
} else if (flexItemRound == 0.33) { //NEW
self.find(".flex-cols-3:last-of-type").addClass("flex-last");//1 remainder 0.33
} else if (flexItemRound == 0.66) { //NEW
self.find(".flex-cols-3:last-of-type").addClass("flex-last");
self.find(".flex-cols-3:nth-last-of-type(2)").addClass("flex-second-last"); //2 remainder 0.66
}
}
add a comment |
up vote
0
down vote
accepted
up vote
0
down vote
accepted
After previously overthinking the whole think I discovered a simple answer, the answer checks the decimal value for the certain column layout when divided by amount of columns.
if(self.find(".flex-item").hasClass("flex-cols-3")) {
var flexItemCount = self.find('.flex-cols-3').length;
var flexItemMath = flexItemCount / 3; //NEW
flexItemMath = flexItemMath % 1; //NEW
var flexItemRound = Number(flexItemMath).toFixed(2); //NEW
if (flexItemRound == 0.00) { //NEW
} else if (flexItemRound == 0.33) { //NEW
self.find(".flex-cols-3:last-of-type").addClass("flex-last");//1 remainder 0.33
} else if (flexItemRound == 0.66) { //NEW
self.find(".flex-cols-3:last-of-type").addClass("flex-last");
self.find(".flex-cols-3:nth-last-of-type(2)").addClass("flex-second-last"); //2 remainder 0.66
}
}
After previously overthinking the whole think I discovered a simple answer, the answer checks the decimal value for the certain column layout when divided by amount of columns.
if(self.find(".flex-item").hasClass("flex-cols-3")) {
var flexItemCount = self.find('.flex-cols-3').length;
var flexItemMath = flexItemCount / 3; //NEW
flexItemMath = flexItemMath % 1; //NEW
var flexItemRound = Number(flexItemMath).toFixed(2); //NEW
if (flexItemRound == 0.00) { //NEW
} else if (flexItemRound == 0.33) { //NEW
self.find(".flex-cols-3:last-of-type").addClass("flex-last");//1 remainder 0.33
} else if (flexItemRound == 0.66) { //NEW
self.find(".flex-cols-3:last-of-type").addClass("flex-last");
self.find(".flex-cols-3:nth-last-of-type(2)").addClass("flex-second-last"); //2 remainder 0.66
}
}
answered Nov 22 at 12:19
Daniel Vickers
354215
354215
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53430165%2fjavascript-jquery-maths-logic%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
what exactly is happening, when you have 43 elements?
– errand
Nov 22 at 11:50
with 43 elements in a 4 col layout it does not add "flex-last" to the last element instead it adds "flex-second-last" the item prior it adds "flex-third-last" leaving the actual 3rd last without a class causing styles to break.
– Daniel Vickers
Nov 22 at 11:52