|
@@ -153,6 +153,7 @@ var _page = {
|
|
|
},
|
|
|
},
|
|
|
init: function () {
|
|
|
+ this.initHotSearchKeysCount()
|
|
|
this.initEvents()
|
|
|
this.initHotBuyerShortName()
|
|
|
this.initHotIndustryTwoLine()
|
|
@@ -164,6 +165,26 @@ var _page = {
|
|
|
this.initImportantGovTab()
|
|
|
this.initHotIndustrySearch()
|
|
|
},
|
|
|
+ initHotSearchKeysCount: function () {
|
|
|
+ // 超出盒子的元素隐藏
|
|
|
+ var container = $('.hot-key-list');
|
|
|
+ var childElements = container.find('.hot-key-item');
|
|
|
+ var containerWidth = container.width();
|
|
|
+ var totalWidth = 0;
|
|
|
+ var lastVisibleIndex = -1;
|
|
|
+ childElements.each(function(index) {
|
|
|
+ var elementWidth = $(this).outerWidth(true); // 包括外边距
|
|
|
+ totalWidth += elementWidth;
|
|
|
+ if (totalWidth > containerWidth) {
|
|
|
+ lastVisibleIndex = index - 1;
|
|
|
+ return false; // 结束循环
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (lastVisibleIndex >= 0) {
|
|
|
+ childElements.eq(lastVisibleIndex).nextAll().attr('data-overflow-hidden', '');
|
|
|
+ container.find('[data-overflow-hidden]').hide()
|
|
|
+ }
|
|
|
+ },
|
|
|
initSearchEvents: function () {
|
|
|
var _this = this
|
|
|
// 切换筛选项
|
|
@@ -281,6 +302,9 @@ var _page = {
|
|
|
// 获取第二行最后一个元素
|
|
|
var $s = _page.getLine2LastDom($(this), $(this).find('li'))
|
|
|
$s.attr('data-simple-hidden', '')
|
|
|
+ if ($s.find('a').text().length < 2) {
|
|
|
+ $s.prev().attr('data-simple-hidden', '')
|
|
|
+ }
|
|
|
$s.nextAll(':not(.more)').attr('data-simple-hidden', '')
|
|
|
$('.hot-industry [data-simple-hidden]').addClass('hidden')
|
|
|
})
|