...
|
...
|
@@ -373,6 +373,30 @@ define('yohood', function(require, exports) { |
|
|
$(".search-btn").click();
|
|
|
});
|
|
|
|
|
|
//截取字符串
|
|
|
function cutString(str, len) {
|
|
|
//length属性读出来的汉字长度为1
|
|
|
if(str.length*2 <= len) {
|
|
|
return str;
|
|
|
}
|
|
|
var strlen = 0;
|
|
|
var s = "";
|
|
|
for(var i = 0;i < str.length; i++) {
|
|
|
s = s + str.charAt(i);
|
|
|
if (str.charCodeAt(i) > 128) {
|
|
|
strlen = strlen + 2;
|
|
|
if(strlen >= len){
|
|
|
return s.substring(0,s.length-1) + "...";
|
|
|
}
|
|
|
} else {
|
|
|
strlen = strlen + 1;
|
|
|
if(strlen >= len){
|
|
|
return s.substring(0,s.length-2) + "...";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return s;
|
|
|
}
|
|
|
//搜素品牌
|
|
|
$('.search-wrap').find('input').on('keyup', function() {
|
|
|
$(".search-btn").trigger("click.search");
|
...
|
...
|
@@ -394,7 +418,7 @@ define('yohood', function(require, exports) { |
|
|
$.each(brands, function(k, v) {
|
|
|
html += '<li><a href="javascript:;" target="_blank" title="' + v.name + '"><div class="img-box" brand_id="' + v.id + '">' +
|
|
|
'<img class="grey-brand-logo" width="145" height="97" src="' + common.getImages(v.logo, 'source', 'blogimg', 'primary') + '" alt="" alt="' + v.name + '"></div>' +
|
|
|
'<p>' + v.name + '</p></a></li>';
|
|
|
'<p>' + cutString(v.name,20) + '</p></a></li>';
|
|
|
});
|
|
|
$(".brand-content").html(template.replace('{li}', html));
|
|
|
} else {
|
...
|
...
|
|