我有一个自定义脚本手风琴 - (“更多”)http://jsfiddle.net/nJpNb/2/自定义jQuery的手风琴和隐藏的下一个DIV
我希望能够做的是隐藏上一页/下一页格$时点击。目前所有面板都保持打开状态,所以脚本大多可以正常工作
任何帮助在这里将不胜感激。
感谢
我有一个自定义脚本手风琴 - (“更多”)http://jsfiddle.net/nJpNb/2/自定义jQuery的手风琴和隐藏的下一个DIV
我希望能够做的是隐藏上一页/下一页格$时点击。目前所有面板都保持打开状态,所以脚本大多可以正常工作
任何帮助在这里将不胜感激。
感谢
只需添加
$(".newsBody").hide();
$('.newsTeaser').show();
到$(".more").click(function() {
DEMO第一线:http://jsfiddle.net/nJpNb/5/
但请缓存中的项目。
尝试增加下面两行的.more
点击如下图所示内,
//hide all others and show newsTeaser
$newsItem.find('.newsBody').hide();
$newsItem.find('.newsTeaser').show();
完整代码:
$(".newsBody").hide();
var $newsItem = $('.newsItem');
$(".more").click(function() {
//hide all others and show newsTeaser
$newsItem.find('.newsBody').hide();
$newsItem.find('.newsTeaser').show();
var $parent = $(this).parent();
$parent.hide();
$parent.parent().find(".newsBody").show();
});
$(".less").click(function() {
var $parent = $(this).parent();
$parent.hide();
$parent.parent().find(".newsTeaser").show();
});
谢谢,这个解决方案也可以。 – webworker 2012-04-04 20:49:18
设置ID给每个部分(让他们有一个类和id)。然后当有人选择第2部分,然后自动隐藏第1部分和第3部分
优秀,作品治疗.. – webworker 2012-04-04 20:48:30
随时接受答案。 – binarious 2012-04-04 20:49:53