Close lightbox on image click?

2 posts, 0 answers
  1. Kim
    Kim avatar
    10 posts
    Member since:
    Oct 2013

    Posted 20 Feb 2014 Link to this post

    Is it possible to close the light box, when the active image is clicked?

    And if so, how would I do that?

    regards Kim Hjort
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 20 Feb 2014 in reply to Kim Link to this post

    Hi Kim,

    Please have a look into the sample code snippet to close the RadLightBox on Image click.

    ASPX:
    <telerik:RadButton ID="FeedbackButton" OnClientClicked="OpenFeedbackLightBox" AutoPostBack="false"
        Text="Share Your Feedback" Skin="Silk" runat="server" />
    <telerik:RadLightBox ID="FeedbackLightBox" runat="server" Width="400px" Height="350px"
        CssClass="lb_feedback" Modal="true">
        <ClientSettings>
            <AnimationSettings HideAnimation="Resize" NextAnimation="Fade" PrevAnimation="Fade"
                ShowAnimation="Resize" />
        </ClientSettings>
        <Items>
            <telerik:RadLightBoxItem>
                <ItemTemplate>
                    <asp:Image ID="Image1" runat="server" ImageUrl="~/Images/cb_go_empty.png" onclick="Close();" />
                </ItemTemplate>
            </telerik:RadLightBoxItem>
        </Items>
    </telerik:RadLightBox>

    JavaScript:
    <script type="text/javascript">
        function OpenFeedbackLightBox() {
            var lightBox = $find('<%= FeedbackLightBox.ClientID %>');
            lightBox.show();
        }
        function Close() {
            var lightBox = $find('<%= FeedbackLightBox.ClientID %>');
            lightBox.hide();
        }
    </script>

    Let me know if you have any concern.
    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top