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

ImageGallery resize to browser window

9 Answers 210 Views
ImageGallery
This is a migrated thread and some comments may be shown as answers.
Andy F.
Top achievements
Rank 1
Iron
Andy F. asked on 28 Sep 2015, 12:22 PM

I have a ImageGallery for showing all thumbnails in a page with Width="100%", which shows fine, but I can't figure out two things:

1. How do you get Height=100%?  I want the gallery to fill the browser page.

2. On resize of the browser window, how do I get the control to resize and adjust the layout to match?

This is what I have for the control right now:

<telerik:RadImageGallery runat="server" ID="rigItems" DisplayAreaMode="Thumbnails" Width="100%" Visible="true" LoopItems="false" AllowPaging="false" ImagesFolderPath="~/"
    DataImageField="ImageUrl" DataTitleField="ImageTitle" DataThumbnailField="ImageUrl" OnNeedDataSource="rigItems_NeedDataSource" >
    <ImageAreaSettings Height="600px" ResizeMode="Fit" />
    <ThumbnailsAreaSettings Height="800px" ShowScrollButtons="false" ThumbnailsSpacing="1px" ThumbnailHeight="200" ThumbnailWidth="200" Mode="Thumbnails" ScrollOrientation="Vertical" ShowScrollbar="true" />
</telerik:RadImageGallery>

9 Answers, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 30 Sep 2015, 02:05 PM
Hi Andy,

In order to make the control take the whole height of the page you need to set the height of all elements that wrap RadImageGallery to 100%. e.g if only the RadImageGallery is placed on the page you should set the height for html, body and form elements.

html, body, form {
            height: 100% ;
        }



Regards,
Viktor Tachev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Andy F.
Top achievements
Rank 1
Iron
answered on 30 Sep 2015, 03:58 PM
That was only half the problem... the other half is on resizing the browser, it doesn't track and there doesn't appear to be a client event or routine to do that.
0
Viktor Tachev
Telerik team
answered on 05 Oct 2015, 10:27 AM
Hello Andy,

If you would like to execute additional logic when the browser window is resized you can use the window.onresize event. Check out the following article that describes the event in more detail.



Regards,
Viktor Tachev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Andy F.
Top achievements
Rank 1
Iron
answered on 05 Oct 2015, 11:15 AM
Right... and what do I have to do to the control to RadImageGallery to properly it via javascript?  There's nothing in the documentation.
0
Viktor Tachev
Telerik team
answered on 06 Oct 2015, 12:03 PM
Hi,

You can call the repaint() function for RadImageGallery in order to re-render the control on the client.

Regards,
Viktor Tachev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Andy F.
Top achievements
Rank 1
Iron
answered on 07 Oct 2015, 06:32 PM
Doesn't cause it to resize to match the 100% width.  How about a working example of how to do this?
0
Viktor Tachev
Telerik team
answered on 09 Oct 2015, 11:24 AM
Hello Andy,

Usually when the height is set in percentage it should be adjusted automatically when the browser window is resized. I have created a sample and it works as expected on my end. You will find it attached. Try to apply similar settings and see how it works for you.

Regards,
Viktor Tachev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Sam
Top achievements
Rank 1
answered on 12 Jul 2016, 07:38 PM

Just in case anyone else has this problem, the 100% height doesn't really work well. Especially if there are a lot of images and you need to allow scrolling (in thumbnail or lightbox view). 

       function ResizeWin() {
           try {
               var h = $("#divMain").height() - $("#divHeader").height();
               if ($find("<%=rigActivityImages_Image.ClientID%>")) {
                   h -= 75;
                   $(".rigItemBox").height(h - $(".rigToolbar").height());
                   $find("<%=rigActivityImages_Image.ClientID%>").repaint()
               }
               if ($find("<%=rigActivityImages_Lightbox.ClientID%>")) {
                   h -= 10;
                   $(".rigThumbnailsList").height(h);
                   $(".rigThumbnailsList").width("100%");
                   $find("<%=rigActivityImages_Lightbox.ClientID%>").repaint()
                   $(".rigThumbnailsList").css("overflow", "auto");
               }
               if ($find("<%=rigActivityImages_Thumbnail.ClientID%>")) {
                   h -= 10;
                   $(".rigThumbnailsList").height(h);
                   $(".rigThumbnailsList").width("100%");
                   $(".rigThumbnailsList").css("overflow", "auto");
                   $find("<%=rigActivityImages_Thumbnail.ClientID%>").repaint()
               }
                } catch (e) { }
            }

0
Viktor Tachev
Telerik team
answered on 15 Jul 2016, 10:55 AM
Hi Sam,

Thank you for sharing your solution with the community. This can help someone with similar requirements.


Regards,
Viktor Tachev
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
ImageGallery
Asked by
Andy F.
Top achievements
Rank 1
Iron
Answers by
Viktor Tachev
Telerik team
Andy F.
Top achievements
Rank 1
Iron
Sam
Top achievements
Rank 1
Share this question
or