Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save DevShahidul/2bb1a283ab3486bb0c054404573c086e to your computer and use it in GitHub Desktop.

Select an option

Save DevShahidul/2bb1a283ab3486bb0c054404573c086e to your computer and use it in GitHub Desktop.
var totalItem = $('#firstMiddle-link-info li').length,
tM = $("#secondMiddle-link-info li").css("margin").split(" "),
Margin = {
Top: tM[0] != null ? parseInt(tM[0]) : 0,
Right: tM[1] != null ? parseInt(tM[1]) : (tM[0] != null ? parseInt(tM[0]) : 0),
Bottom: tM[2] != null ? parseInt(tM[2]) : (tM[0] != null ? parseInt(tM[0]) : 0),
Left: tM[3] != null ? parseInt(tM[3]) : (tM[1] != null ? parseInt(tM[1]) : (tM[0] != null ? parseInt(tM[0]) : 0))
},
TotalMargin = Margin.Right + Margin.Left,
totalElementMargin = TotalMargin * totalItem;
console.log(totalElementMargin);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment