JQuery隐藏显示详情功能

时间:2023-03-09 18:33:25
JQuery隐藏显示详情功能

放置两个DIV:
初始DIV :在Repetr绑定设置文字隐藏(三元运算符):'<%# Eval("字段2").ToString().Length>11?Eval("字段2").ToString().Substring(0,10)+"…":Eval("字段2").ToString() %>'

详情DIV :默认display:none,height:auto;overflow:hidden;min-height:最小高度

$(".ActivitydetailsButton").click(function(){
   
         var zt=$(this).text();
      
           if(zt=="查看详情"){
           $(this).html('隐藏详情');

/*初始DIV隐藏*/
            $(this).parent().parent().parent().children().next(".ActivityDivs").hide();

/*详情DIV显示*/
            $(this).parent().parent().parent().children().next(".ActivityDivHidden").show();
          
           }
        if(zt=="隐藏详情"){
         $(this).html('查看详情');
           $(this).parent().parent().parent().children().next(".ActivityDivHidden").hide();
            $(this).parent().parent().parent().children().next(".ActivityDivs").show();
           }
       
         });