$(".topLevelCategoryContainer img").width($(this).parent().parent().width()).css({ "text-align": "center", "border": "none", "margin-left": "0" });
我不理解.width和.parent()。 感谢。
答案 0 :(得分:0)
// this gets images within the .topLevelCategoryContainer element
$(".topLevelCategoryContainer img")
// this sets the width of the image
.width(
// this gets the value to set the width to, in this case
// to the same width as the images parents parent
$(this).parent().parent().width()
)
//this sets CSS on the image
.css({
"text-align": "center",
"border": "none",
"margin-left": "0"
});