$('#experiences').click(function () {
var cb = function () {
$('#experiences').addClass('active');
$('#hiddenExperiences').slideDown();
$('#addExperiences').fadeIn();
return false;
}
closeFilters(cb);
return false;
});
$('.btn-close').click(function () {
var cb = function () {
return false;
};
closeFilters(cb);
return false;
});
function closeFilters(callbackFunc) {
$(".active").removeClass("active");
$(".add-filters").fadeOut(250);
$(".hidden-filters").slideUp("slow", callbackFunc);
}
<div class="heading" id="experiences">
<p><a href="#">Experiences</a></p>
</div><!--heading-->
<div class="filter">
<div class="hidden-filters" id="hiddenExperiences">
<p>Filtering by:</p>
<ul class="curr-filter"></ul>
</div><!-- hidden-filters -->
<div class="add-filters extra-width" id="addExperiences">
<div class="inner">
<a href="#" class="btn-close"></a>
<h4 class="title-filtery">Filtery By:</h4>
<div class="btn-holder clearfix">
<input type="button" class="btn-update" value="" />
</div>
</div>
</div><!-- filters -->
</div><!-- filter -->
答案 0 :(得分:3)
答案 1 :(得分:2)
您可以在Javascript onClick按钮上执行此操作:
function toggle_visibility(id) {
var e = document.getElementById(id);
if(e.style.display == "inline") {
e.style.display = 'none';
}
else if(e.style.display == "none") {
e.style.display = "inline";
}
}
答案 2 :(得分:1)
看起来您正在将.active类添加到id = experience
的所有元素中$('#experiences').addClass('active');
你需要找到被点击的元素并通过它。
var tgt;
$('#experiences').click(function (event) {
tgt = $(event.target);
var cb = function () {
$(tgt).addClass('active');
$('#hiddenExperiences').slideDown();
$('#addExperiences').fadeIn();
return false;
}
closeFilters(cb);
return false;
});
我不确定你的扩展是如何工作的,但那是你需要看的地方。
答案 3 :(得分:0)
我用过这是我正在做的另一个项目,可能会有一些帮助
JS:
$('.container .ui-widget-header').click(function(){$(this).parent().children('.ui-widget-content').slideToggle()});
HTML:
<div class="container">
<div class="ui-widget-header">Title</div>
<div class="ui-widget-content">Content</div>
</div>
<div class="container">
<div class="ui-widget-header">Title2</div>
<div class="ui-widget-content">Content2</div>
</div>