Jump to content

Show/Hide


NONAME_2

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/220989-showhide/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/220989-showhide/#findComment-1144403
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.