NONAME_2 Posted December 8, 2010 Share Posted December 8, 2010 Hi everybody, I have a HTML/PHP code: echo'<div class="wideget">'; while( $row_cat = mysql_fetch_assoc($result) ) { $dt = strtotime($row_cat['postdate']); $year = $c_cat->date("Y",$dt); $month = $c_cat->date("F",$dt); echo' <div class="showhide">'; if($current_month != $month || $current_year != $year) { echo' <h3 class="damo" id="cats">'; echo "$month "; if($current_year != $year) { echo "$year "; } echo' </h3>'; } //if($current_year != $year) { echo "$year "; } $current_year = $year; $current_month = $month; echo' <div class="links">'; echo '<a href="news.php?id='.$row_cat['id'].'">' . $row_cat['title']. '</a>'; echo'</div></div>'; } echo'</div>'; and I have a js code: /* Show/Hide */ $(document).ready(function(){ $("#cats").hide(); $("h3.showhide, span.showhide").toggle(function(){ $(this).addClass("active"); }, function () { $(this).removeClass("active"); }); $("h3.showhide, span.showhide").click(function(){ $(this).next(" #cats ").slideToggle("slow"); }); }); but it doesn't work! I want year and month place as tab and by click on each tab it open(OR)close such as Accordian. TNX Quote Link to comment https://forums.phpfreaks.com/topic/220989-showhide/ Share on other sites More sharing options...
NONAME_2 Posted December 8, 2010 Author Share Posted December 8, 2010 Hi , The schema is: 2010,11 newstitle1 newstitle2 newstitle3 2010,10 newstitle4 newstitle5 newstitle6 2010,09 newstitle7 newstitle8 newstitle9,... code: ... while( $row_cat = mysql_fetch_assoc($result) ) { $dt = strtotime($row['postdate']); $year = $date("Y",$dt); $month = $date("F",$dt); if($current_month != $month || $current_year != $year) { echo "$month "; if($current_year != $year) { echo "$year "; } } $current_year = $year; $current_month = $month; echo '<a href="news.php?id='.$row['id'].'">' . $row['title']. '</a>'; } I edited my last post .year/month are as tab ;by clicking on each tab it open(OR)close such as vertically Accordian js. TNX Quote Link to comment https://forums.phpfreaks.com/topic/220989-showhide/#findComment-1144403 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.