This is a migrated thread and some comments may be shown as answers.

Close lightbox on image click?

1 Answer 150 Views
LightBox
This is a migrated thread and some comments may be shown as answers.
Kim
Top achievements
Rank 1
Kim asked on 20 Feb 2014, 01:27 PM
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

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 21 Feb 2014, 03:05 AM
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.
Tags
LightBox
Asked by
Kim
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or