I just started an internship with a company and I am learning jQuery on the fly. Yesterday my boss sat down with me and showed me some new statements including 'if' and '%'.. Here's an example of the code he created yesterday. He then told me that I need to comprehend and learn how to do what he had done. So I figured a good way to do this would be to start from the beginning of it, however when searching Lynda.com tuts I don't really know what to look for. He's out of town so I cannot disturb him. Could somebody please help direct me how to learn about these functions? I believe he referred to them as conditions, is this correct? What we were attempting to do was create a solid 1 px collapsing border around some divs for an ecommerce template.
Thanks!
function resetCategoryBorders(){
$(".topLevelCategoryContainer").each(function (index) {
var catwrapwidth=$("#wp_categorywrapper").width();
var toplevelwidth=$(".topLevelCategoryContainer:eq(0)").width();
var availablewidth=(toplevelwidth>0 ? parseInt(catwrapwidth/toplevelwidth) : 0);
if (parseInt(index+1) % 4 !=0 && index!=$(".topLevelCategoryContainer").length)
{
$(this).css("border-right","0px");
}
$(this).appendTo($("#wp_categorywrapper"));
});
Aucun commentaire:
Enregistrer un commentaire