[英].show elements and .hide elements
I've got this problem : 我有这个问题:
I want when i click one "outer" div hide all outer div's and show me the next div content. 我想当我单击一个“外部” div时,隐藏所有外部div并显示下一个div内容。
This is the function. 这就是功能。 Wich it works there http://jsfiddle.net/Weinz/jdFRw/4/
它在那里工作http://jsfiddle.net/Weinz/jdFRw/4/
But on test site only hide .outerDiv doesn't show next .innerDiv 但是在测试站点上,仅隐藏.outerDiv不会显示下一个.innerDiv
$(function() {
$(".outerDiv").click(function() {
$(".outerDiv").hide();
$(".innerDiv").hide();
$(this).next("div").show();
});
$(".innerDiv").click(function() {
$(".outerDiv").show();
$(".innerDiv").hide();
});
});
The real html code is this 真正的html代码是这个
<div class="block outerDiv"><a href="#"><img src="images/placeholder.jpg" width="165" height="74" alt="Temp" /></a></div>
<div class="container innerDiv" style="display:none;">
I think the problem is on .next but i try diferent options and nothing work. 我认为问题出在.next上,但我尝试使用不同的选项,但没有任何效果。
If i don't set the display in the innerDiv it works... 如果我没有在innerDiv中设置显示,它将起作用...
Try this 尝试这个
$(function() {
$(".outerDiv").click(function() {
$(".outerDiv").hide();
$(".innerDiv").hide();
$(this).next("div").show().css('display', 'block');
});
$(".innerDiv").click(function() {
$(".outerDiv").show();
$(".innerDiv").hide();
});
}); });
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.