记录生活

my jquery toggle plugin script

<Category: Web> 查看评论

toggle
通过传入当前需要显示的Id,自动展开对应的条目。($current_news_id标示当前Id)

<script type="text/javascript">
<!-- 
 $(document).ready(function(){    
           $("div").filter(".handler").click(
                function()
                {                   
                    $(this).next(".news_detail").toggle();                  
 
                });
   $('#n<? echo $current_news_id; ?>').css("display","block");
}); 
//--> 
</script>
<style>
<!--
.newItem{margin-bottom:10px; }
.clickme{cursor:pointer;}
.news_detail{display:none;}
-->
</style>
<? foreach ($news as $newItem){ ?>
<div class="newItem" style="width:100%;">
<div class="handler nav_font" >
<a><?php echo  $newItem->title; ?></a>
<span style="color:#CCCCCC;font-size:12px;font-weight:400"><?echo date('Y年m月d日 H:i', $newItem->pubtime);  ?></span></div>
<div id="n<? echo $newItem->news_id; ?>" class="news_detail">
<table>  <tr><td valign="top"><div><?php echo  $newItem->content; ?>   </div></td></tr></table>
</div></div>
<?} ?>

本文来自: my jquery toggle plugin script



发表评论

您必须登录后才能发表评论。