最近搜索
没有最近搜索

Rob Levin
已加入2021年4月16日
·
最后活动2021年10月27日
关注
0
关注者
0
活动总数
5
投票
0
订阅
3
活动概览
标记
文章
帖子
社区评论
文章评论
活动概览
的最新活动 Rob Levin
Rob Levin 进行了评论,
I'm cross posting this as I think the js solution is bloated and fragile. Just use CSS:
.recent-activity-item:nth-of-type(1n+4) {display: none;}
Of course I'm using the list item class for recent activity items, but this will work with any of 'em. The 1n+4 just say "for any of these item types from 4 on, kick in the following code".
查看评论 · 已于 2016年4月06日 发布 · Rob Levin
0
关注者
0
投票
0
评论
Rob Levin 进行了评论,
There are several pages that come up regarding this search-box customization and I really felt that the information does not address that if you jquery in the customized placeholder text on document ready, there's a flash of the default 'Search'. My solution was to hide it initially and add a 'loaded class then unhide it. There's a bunch of extra CSS in there but you should be able to get the general approach (and no longer have a flash of unwanted text!):
/* Hide initially */
input::-webkit-input-placeholder { color:transparent; }
input::-moz-placeholder { color:transparent; }
input::-moz-placeholder { color:transparent; }
input::-ms-input-placeholder { color:transparent; }
/* when we've added the .loaded class we kick in the opaque placeholder */
input.loaded::-webkit-input-placeholder {
color: $color_3;
opacity: .5;
transition: opacity 0.35s ease;
}
input.loaded::-moz-placeholder {
color: $color_3;
opacity: .5;
transition: opacity 0.35s ease;
}
input.loaded::-moz-placeholder {
color: $color_3;
opacity: .5;
transition: opacity 0.35s ease;
}
input.loaded::-ms-input-placeholder { color:transparent; }
input:focus::-webkit-input-placeholder {
opacity: 1;
}
input:focus:-ms-input-placeholder {
color: 1;
}
input:focus::-moz-placeholder {
opacity: 1;
}
Here's my javscript (within document ready as stated above already):
$('#query').attr('placeholder',"Have a question? Search our knowledge base the answer…").attr('autocomplete', 'off');
//Signify that we can unhide the placeholder
$('#query').addClass('loaded');
查看评论 · 已于 2015年11月10日 发布 · Rob Levin
0
关注者
0
投票
0
评论