list.js 741 Bytes
/**
 * 商品列表页
 * @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);
}());