Setting a group to be % of viewport height dynamically

Way late - but the approach in this video was perfect for what I needed: http://forum.bubble.io/t/floating-map-full-height-of-viewport-until-footer/81925/2?u=venddy

In my opinion best approach to this is to install the classify plugin and use CSS

After installing classify plugin you would add classes to the id attribute of the element you want to target

Screen Shot 2021-01-10 at 12.48.04 PM

then place an HTML element onto the page and put the styling required

Screen Shot 2021-01-10 at 12.47.53 PM

The example above is full screen

if wanted half height would do 50vh

if wanted half width would do 50vw

the benefit of this approach is that you have even more control through CSS of the elements size as you could also calculate based on other elementsā€¦an idea is I have a header of 100px at top of screen so my ā€˜full height elementā€™ should be full screen height less the 100px taken up by the header.

Another benefit is that you can then start to control all elements, something I donā€™t believe the hero sizing with toolbox plugin allows for since that just gives 100% all the time with no granular control

Using CSS also doesnā€™t require a workflow action, so no timing issues to deal with. Plus you can use conditionals to change the CSS or change the Class of the element, something Iā€™ve employed for fully responsive designs on mobile that consider the orientation of the device in real time as the device is rotated.

11 Likes

I agree, that definitely seems to be the best solution. Thank you!

3 years (or more later) I 100% support the classify-based solution. It didnā€™t exist when I first came up with this!

1 Like

ā€¦ I just wonder how to get rid of the ugly white edge when the background is being blurred by a popupā€¦ but this topic probably belongs elsewhereā€¦

Using the Classify solution, do you need to apply the CSS to the groups AND the elements within it that you want to be full height? Or is it only necessary to make the element itself full height? Will not adjusting the parent group cause issues?

You would need to manage both the element itself and its parent (wrapping) container, up until the point that youā€™ve hit the page level.

Amazing!!

$6 for js workflow plugin gone. This doesnā€™t work

Itā€™s the JS toolbox plugin Toolbox Plugin | Bubble

This is working on my page element but not on my group element. why?

You probably arenā€™t walking the DOM. Add the Classify plugin, and make sure you add a class to that group element. Youā€™ll need to adjust your CSS rule to flow down to that element.

Iā€™ve added the class to the group. I donā€™t know what you mean by walking the DOM but the group is the group contains all other elements in on the page.

Just In case Iā€™m applying the right solution to the right problem i need to specify that my problem is getting the page height to adjust to the currently visible group.

I donā€™t know. If it is setup properly it would.

checklist:
-created html element within the group and pasted div with id ā€œanchorā€ in the appearance tab
ā€“set id of the group to ā€œanchorā€
-installed toolbox
-create workflow with run javascript (on page load). Paste javascript inside.

group still doesnā€™t show 100% viewport height. where did i go wrong

I donā€™t knowā€¦I donā€™t recommend the javascript method

1 Like

I would suggest trying the classify method. Remember - you need to set both the target group and the wrapper, all the way up to the top level group to also be 100vh. This means you may need to either (a) apply a single class to multiple groups, or otherwise define multiple classes that are 100vh, depending on what your specific needs are. That said - there may be some additional math needed, if you have stacked groups (so one may be 10vh, and another may be 90vh for example)

Iā€™m completely stuck on this.

Iā€™ve installed the ā€˜classify pluginā€™
However I canā€™t find a place to add the ID Attribute.

Do you do it on the page?
on a group or whatever element you want set the viewport for?

But first and foremost I canā€™t find the ID Attribute field.

Go to the settings Tabā€¦then General and scroll to the Favicon section and check the box to expose id (just under the two color options)

1 Like

thank you @boston85719 that worked.
However I canā€™t get a picture to fill my my entire background and Iā€™m not sure what Iā€™m doing wrong.

I have installed classify plugin
Iā€™ve added to my page the the following ID:

{addClass:"floater"}

Iā€™ve then set a image as background
Iā€™ve added a html element with the following in apperance:

<style>
    .floater{
    height: 100vh !important;
    width: 100vw !important;      
    }
</style>

What do I do wrong if i want the picture to take over my screen?