我有一個自定義腳本手風琴 - (「更多」)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