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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.