Created
August 26, 2011 19:53
-
-
Save fnhipster/1174272 to your computer and use it in GitHub Desktop.
Get boxes in the last column and row of a table of 3 columns
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Making fancy borders on the product listing page. | |
var total = $(".ProductList li").length; | |
var last_row = Math.ceil(total/3); | |
var n; | |
var current_row; | |
$(".ProductList li").each(function(i){ | |
n = i+1; | |
current_row = Math.ceil(n/3); | |
// Get boxes in the last column. | |
if( n%3 == 0 ){ | |
$(this).css("border-right","0 none"); | |
} | |
// Get boxes in the last row | |
if( current_row == last_row ){ | |
$(this).css("border-bottom","0 none"); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment