list.js
741 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* 商品列表页
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/11/23
*/
var $ = require('yoho.jquery');
require('./filter');
require('./sort-pager');
require('./latest-walk');
require('./product');
(function() {
var $banner = $('.banner-img'),
img;
if ($banner.length === 0) {
return;
}
img = new Image();
//重置Banner高度
img.onload = function() {
if (img.height) {
$banner.height(img.height);
}
img = null;
};
//replace('"', '')为处理浏览器兼容性代码,部分浏览器中取得的字符串中包含""
img.src = $banner.css('background-image').replace(/"/g, '').slice(4, -1);
}());