$("#dog-imgUrl").css("background", "url(" + res.data.dogImgUrl + ") no-repeat center center")

$("#dog-imgUrl").css("background-size", "cover")

取代原有的IMG标签存放图片,使用外层的DIV背景来作为图片显示框,重点核心是:

background:url(图片地址) no-repeat center center;
background-size:cover;