Forum Academy Marketplace Showcase Pricing Features

Setting a group to be % of viewport height dynamically

I am not sure. Could be plenty of things; one might be the type of elements you are using or the classes you are adding.

Are you trying to do something like my template?

1 Like

I’m not sure, I’m just trying to get a picture to fill the entire background of my canvas and have it resize as the viewport gets smaller or bigger.

1 Like

@kim3 can you post a link to your editor so that I can see what is going on?

1 Like

Or shoot me a dm?

1 Like

Stupid, question but how do I link to the editor?
Do you just mean pics of the editor? or is there a secret sharing function im not aware of?

Hello everyone! First post here :smiley: I’ve managed to set the height of a group, let’s call it “Group A” to 100% using the classify plugin and the minimum height to override this setting to avoid issue with smaller viewports. However, no matter what I’ve tried, I keep getting a blank white space underneath “Group A” between it and the next group, “Group B”. “Group A” is not a child of anything other than the “index” so I am at a loss now. I’ve tried setting margin-bottom and padding-bottom both to 0px but it did not help. “Group A” and “Group B” are touching with no white space between them on my index. Any help would be appreciated!


Update 2: when it is the full size of my screen, but not technically full screen, there is no white gap. As soon as I click full screen, the white space is back.

Turns out adding one more group above that group fixed it… weird

Just tried the Classify approach on a single page app with various groups and have to say it worked beautifully. Much smoother than the previous approach.
Some learnings:

  • Use {addClass: X} and {removeClass: X} as the various groups are shown and hidden
  • Use calc() to account for things like floating headers and/or footers
    – e.g. calc(100vh - 50px) if you have a 50px high footer. NB! calc(100vh-50px) doesn’t work

This is actually expected behavior.
In “traditional” web design, the various elements (div’s, etc) react to each other, because you simply can’t have magical whitespace without setting a specific element to be absolutely positioned.

In Bubble’s render engine, an element is ALWAYS absolutely positioned, unless it is touching and/or encompassed by another element. This means that in order to have group X affect group Y, they need to have some sort of established relationship (i.e. they should be contained within a group themselves).

If you carry the responsive model over to bubble, what happens, in order to create a truly responsive page, is that you will need to use a variety of “spacer” elements that may not actually be seen by the end user, but they do affect the elements that can be. As an example - let’s say that you have a floating group that wraps a vertical side menu. When the page width is < 768px, you hide that floating group.

Your other page elements don’t move. There’s just a large white space where the hidden floating group would be visible.

The way you adjust for this is to have a transparent group BEHIND the floating group, that you then set whatever conditional adjustments, or responsive setting to, and the other elements react accordingly.

1 Like

made a video tutorial on this topic Dynamically adjust Bubble page heights for mobile screens - make your apps look good on mobile screens

What an awesome thread. Thanks @brian1 for the great solution provided and @boston85719 for the classify idea.

I’ve successfully added 100vh and 100vw to my app page, but I’m struggling with a repeating group.

My setup:
page width: 1280px
page height: 900px

I placed a RE in the page that with 1215px (w) - 900px (h), and inside the RE among other elements I have a “Ext vertical scrolling” RP that stretches all the way to the bottom of the RE. Once made the main page 100vh and 100vw the RP broke and didn’t scroll. I tried to make it “vertical scroll” but now it only scrolls if the page viewport is higher than 900px.

*Btw: The RG also doesn’t stretch to the bottom of the page. It leaves an empty space between the viewport and page height difference.

Any hints what could be causing this and how to fix it?

Reusable Element

Main page


Thanks in advance :slight_smile:

can you share a link to the app?

Couple of thoughts here:

  1. You’ve statically defined the height and width of the RE. You need to actually calculate this dynamically. (I’ll get to this in a second)
  2. I personally wouldn’t probably use external scroll unless you have to. If you’re trying to hide the scrollbar, just do something like #RE_rg_id{overflow-y:hidden !important} in an html element (wrap it in <style></style> tags so its an actual CSS style sheet). That will hide the scrollbar. #RE_rg_id in this case is the id tag that you apply to the rg.

In regards to #1 above - what you need to do is calculate the:

  1. window height (the height of the browser window)
  2. height of the element(s) above rg
  3. get the pixel coordinate for the bottom of the element above the rg
  4. position the top of the rg in the proper place (the y axis offset)
  5. set the height of the rg to fill the remainder of the VH of the window

To get you headed in the right direction, you’ll need to use the “run javascript” in a page loaded workflow. You need to get the bounding client rectangle on the window for whatever div’s you’re having to use in the above. To do that you’ll use something like the following:

var header = document.getElementById('header');
var rect = header.getBoundingClientRect();

This will give you an object that will look like this:

  bottom: 775,
  height: 775,
  left: 0,
  right: 1322,
  top: 0,
  width: 1322

From there, you’ll need to set the position and height of the rg (or its wrapper), by doing something like:

var rg = document.getElementById('rg_id'); = absolute; = rect.bottom +1; = 100vh - rect.height;

Hope that helps get you in the right direction.

One other thought - you’ll probably want to do an on page resize event with the same thing as well.


For getting a RG to stretch to the bottom as long as there is enough data retrieved to do so and then to restrict it from expanding beyond, I put the RG into a Group. I set up the Group to have a max height equal to 100VH and put the scroll to ‘auto’ and if I don’t want the scrollbar visible, I make adjustments to its styling.

The RG is set to full list (usually I restrict it with :items until operator and add pagination, but that might not be what you are looking for). When it is full list and the Group is set to max width with scroll on auto, if the full list goes beyond the max height setting the scroll bar kicks in and allows the RG to be scrolled.

I typically put the scroll bar onto the container Group.

BTW, what is an RP?

1 Like

Hey @brian1, a link to the editor or version-test preview?

Hey @brian1 thanks for jumping in and helping me out.

Regarding #2, I’m not using external scroll. I change it in favor of a vertical scroll. (not sure if the full list would be better suited for this use case, but having clients with 2.5k+ contacts in their DB could take a few extra seconds to load unless I add Algolia for the indexing).

I kinda lost you on #1. The logic makes perfect sense to me, but running the javascript is just for retrieving the object?

I tried to run the javascript but it threw me an error. I checked the console:

What I’m trying to achieve is:
1 - Page 100vh; 100vw :white_check_mark:
2 - Reusable element adapts to the viewport correspondently to #1 :thinking:
3 - Make the Repeating Group inside the reusable element scroll in and load more database entries :x:

Hey @boston85719, thanks for the insight.

That’s exactly what I’m trying to achieve with the RG.
When you say:

set up the Group to have a max height equal to 100VH

I could do to it by adding a class to the group with classify, and insert in the html:
max-height: 100vh !important;
overflow: auto !important;

How do you apply the scroll bar to the container group instead go the Repeating Group?

*RP was a tipping error, I meant RG. When I wrote this post was almost 4 am in Lisbon, Portugal :sweat_smile:

I got this to work, but know the RG doesn’t scroll…


I forgot to add “-y” to the overflow and replaced “auto” for “scroll”.

max-height: 100vh !important;
overflow-y: scroll !important;

Now it’s WORKING!!! @boston85719 thanks for the tip mate! I owe you a beer!

Same way you did I believe, as the code you shared looks like it is attributed to the group.

No worries, glad you got it to work.

hey all, here’s a new plugin to help improving vertical responsiveness of groups. Among the different tools offered, there’s one to set a group’s height based on the viewport!

1 Like

The RG is set to full list (usually I restrict it with :items until operator and add pagination, but that might not be what you are looking for). When it is full list and the Group is set to max width with scroll on auto, if the full list goes beyond the max height setting the scroll bar kicks in and allows the RG to be scrolled.

FYI this has a Bubble glitch if there’s anything underneath the RG on the page, such as a message-entry field in a chat window. Bubble will still calc the “actual” total height and draw all footer-type elements at a (potentially very) large offset underneath. This was also detailed here:

Haven’t found a great way yet to either A) stop Bubble from drawing footer elements at full-offset when using full list RG style or B) force Bubble to load ALL RG elements on page load when in Vertical Scrolling style. There’s a hack for (B) that involves forcing a scroll-to to the bottom RG element and then back to the top element, which will indeed force all the RG’s rows into view, but it’s pretty glitchy looking to the user. If anyone’s got any ideas, I’d love to hear them!