Sticky Form for Desktop Only


#1

Hi, I’m building a landing page with a form that sticks to the right side of the page. I’ve used the ID with position: fixed; to make this happen.

Is there a way to disable this for the mobile experience?

Thanks!


#2

Hey there,

I would suggest that you hide :eye::no_entry_sign: the form on mobile and use a new form in the mobile builder.

Likewise make sure you hide your new “mobile” form from the desktop view. You can select the :eye: icon in the “Contents” tab in the builder to accomplish this.

Let me know if you need anymore help!


#3

I tried what you said, but wasn’t able to drop another form on the page. Correct me if I’m wrong, but I think I can only have one form per page.


#4

Ah that’s right, crucial error on my part. Sorry about that.

Hmmm I’m thinking of other options that don’t get too complicated :thinking:


#5

Hi @BlaineBelo!

You could try using this bit of css:

<style>
  
  @media only screen and (max-width: 525px) {
  #lp-pom-form-181{
  width: 100% !important;
    }
}
  
</style>

Or maybe something some alternative styling to remove the float.
Just make sure to replace the form ID with yours.

Hope that helps!


#6

Boom! @Caroline knows what to do :smiley:

Custom CSS would be my last resort. @BlaineBelo if you can implement an @media only css…for the float portion of the form, I bet that would be bulletproof.


#7

Thanks @Caroline and @Kyle.C, but I still can’t get it to work.

I tried the media query you sent me, but it seems to have the opposite effect. Maybe sharing the actual page could help: http://www.beloandco.com/print-promo-credit-unions/

Thanks.


#8

@BlaineBelo

Looks like the box the form is in is set to fixed. Here is what I am seeing:

@media only screen and (max-width: 525px)
#lp-pom-box-394 {
    position: fixed;
    width: 100% !important;
    right: 0;
    margin: 0 auto;
    z-index: 999;
   }

#9

@Caroline

Did I mention that I don’t know what I’m doing? I cobbled that code together from other forum posts. There isn’t any info I’ve found that can help me achieve my goal which seems like a CRO no-brainer.

Goal: a sticky form that slides on the right side of the screen on Desktop, but remains static on mobile so it doesn’t cover up all of the content.

If you could help provide code that does this then I would be massively grateful.

I added your code from the above post, but the form doesn’t slide on desktop.


#10

@Kyle.C @Caroline

Please help me. How do I create a sticky form for desktop but not for mobile?


#11

Well what I see in your page doesn’t include @Caroline’s suggestion.

Capture

It will be crucial to have @media only screen and (max-width: 525px) in the box styling where my red squiggle is. Are you able to include that?


#12

I updated it with the code, but it still isn’t working correctly:
https://www.beloandco.com/print-promo-credit-unions/


#13

Got it, so if I understand your code correctly… we need to make two edits and we are done!

In the code you just edited, change “fixed” to “absolute”.

@media only screen and (max-width: 525px) {
#lp-pom-box-394 {
position: absolute;
right: 0;
margin:0 auto;
z-index:999;
}
}

Then we need to make opposite change for the desktop styling “absolute” to “fixed”. But I’m not sure if that is part of what you have added custom.

#lp-pom-box-394 {
display:block;
background:rgba(245,245,245,1);
-pie-background:rgba(245,245,245,1);
border-style:none;
behavior:url(//d9hhrg4mnvzow.cloudfront.net/PIE.htc);
border-radius:0px;
left:8px;
top:240px;
z-index:13;
width:303px;
height:651px;
position:fixed;
}


#14

Sorry @BlaineBelo - I was at work!
Here is the code you will need. Just update your IDs.

<style>
  
#lp-pom-box-185 {
  position: fixed !important;
  right: 0 !important;
  margin: 0 auto;
  z-index: 999;
  }
  
  
  @media only screen and (max-width: 525px){
	#lp-pom-box-185 {
    	position: relative !important;
  }
  }
  
</style>

Here is an example of it working: https://unbouncepages.com/test-page-fixed-form/

Hope that helps!


#15

YESSSS!!!

@Caroline and @Kyle.C

You rule. Thanks a ton for your help!


#16

I’m glad you got it working @BlaineBelo :slight_smile:

Thanks @Caroline


#17

I need to ask both you and @Caroline since you guys worked on this.

Is there a tested way to stop this sticky form at footer? Since what is currently happening on my page, on some devices, is that the form goes through the footer due to display having a smaller height. You can check that out here http://unbouncepages.com/shiftsuite-landing-page/

Any feedback would be appreciated. Thanks.