[英]Hidden menu (jquery, css)
Patient: http://demo.imatte.us/fomru/project_people.html 病人: http : //demo.imatte.us/fomru/project_people.html
Screen: http://i.stack.imgur.com/GkBST.png 屏幕: http : //i.stack.imgur.com/GkBST.png
Hidden menu works incorrect. 隐藏菜单工作不正确。 After click on link, menu shows, but after 'mouseover' it disappears.
单击链接后,显示菜单,但在“鼠标悬停”后消失。 I need to disable this, and hide menu just after click out of menu.
我需要禁用此功能,并在单击菜单外后隐藏菜单。
(function($) {
$(function(){
var $judgments = $('.project .jugdments-list .item');
$judgments.each(function(){
limit($(this).find('.title'), 140);
limit($(this).find('.text'), 200);
});
var $filters = $('.filters-list>li');
$filters.each(function(){
var $filter = $(this);
var $filterBody = $filter.find('.filter');
$filter.find('.filter-name').click(function(){
$('.filters-list .filter').not($filterBody).fadeOut();
$filterBody.fadeToggle();
});
});
$(document).click(function(e){
if ( !$(e.target).closest('.filters-list').length || $(e.target).is('.filters-list') ) {
$('.filters-list .filter').fadeOut();
}
});
});
function limit($elem, length) {
var text = $elem.text();
if ( text.length > length ) {
$elem.text(text.slice(0, 140)+'…');
}
}
})(jQuery);
If I got right what do you mean, then this should help you: 如果我理解正确,您的意思是什么,那么这应该对您有帮助:
remove 去掉
.filters .filters-list>li:hover .filter {
display: block;
}
and add this: 并添加以下内容:
$('.filter-name').each(function() {
var that = $(this);
that.hover(
function() {
$('.filters-list .filter').not(that.parent().find('.filter')).fadeOut();
that.parent().find('.filter').fadeIn();
},
function() {}
)
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.