阅读更多项目按钮

时间:2017-11-15 15:25:46

标签: javascript c# jquery asp.net

我有telerik:RadRotator ItemTemplate<a href="#" class="read_more"><br/>...voir plus</a>的evry项目JQuery

$(function () {
    $('.news-info').each(function (event) {
        var max_length = 300;
        debugger;
        if ($(this).html().length > max_length) {
            var short_content = $(this).html().substr(0, max_length);
            var long_content = $(this).html().substr(max_length);

            $(this).html(short_content +
                '<a href="#" class="read_more"><br/>...voir plus</a>' +
                '<span class="more_text" style="display:none;">' + long_content + '</span>');

            $(this).find('a.read_more').click(function (event) {
                event.preventDefault();
                $(this).hide();
                $(this).parents('.news-item').find('.more_text').show();
                $(".news-item").toggleClass('expanded');
                $(".news-info").toggleClass('expanded');
            });
        }
    });
});

  <ItemTemplate>
        <div class="news-item">
            <table>
                <tr>
                    <td style="width: 50px; height: auto;">
                        <img src="~/Img/ImgLettreNEWS/NEW.png" runat="server" alt="Avatar" class="news-avatar" />
                    </td>
                    <td>
                        <asp:Label runat="server" ID="LblNewsTitle" CssClass="news-title" Text="BOUZID Ghassen" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2">

                        <div runat="server" id="DivHmtlContent" class="news-info">
                        ...........
                        </div>

                    </td>
                </tr>
            </table>

        </div>

        <asp:Image ID="Img_News" runat="server" class="RotatorImage" Style="width: 82px; height: 59px" />
        <br />
        <%#  DataBinder.Eval(Container.DataItem, "TITRE")%>
    </ItemTemplate>

我的问题是,当我点击阅读更多按钮时,所有项目都已扩展

0 个答案:

没有答案