Lightbox form position | Community
Skip to main content
David_Mezkiriz
Level 2
Apr 22, 2020 10:02 AM UTC
Solved

Lightbox form position

Hi everyone,

 

I was trying to manipulate the lightbox form - form2.js - css position, the top, left attributes when it is displayed. We have a button in the middle of the page - height,width position - , and when we click on it, the lightbox form is displayed on the top position of the page so the page jumped to the top of it cause it is quite long. How can I change this behaviour so when I click on the button the displayed form is shown in the same position as the button. What I need basically is to manipulate the top, left and position css attributes of the form dialog. Is it possible?

 

MktoForms2.whenReady(function(form){if(typeof(MktoForms2.defaultForm)=='undefined')MktoForms2.defaultForm=form;});

[...] $('.linkbutton').click(function(){ var formId = $(this).attr('data-form'); var f = formId > 1000 ? MktoForms2.getForm(formId): MktoForms2.defaultForm; MktoForms2.lightbox(f).show(); }); [...]

Hope you understand me. Thanks in advance for your help.

 

Regards,

David

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
Apr 22, 2020 8:44 PM UTC

I wonder if you need the native lightbox at all? If you want the button to be visually aligned with the form, maybe have the form just draw next to the button (demo at https://cdpn.io/figureone/debug/3e8aabf97879b8b432f13d113e34313f😞

 

4 replies

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
Apr 22, 2020 8:44 PM UTC

I wonder if you need the native lightbox at all? If you want the button to be visually aligned with the form, maybe have the form just draw next to the button (demo at https://cdpn.io/figureone/debug/3e8aabf97879b8b432f13d113e34313f😞

 

Translate
David_Mezkiriz
Level 2
Apr 23, 2020 10:36 AM UTC

Hi Sandford,

 

that helped me to achieve what I was looking for and solve my problems. Probably next time we do not try to use a lightbox form for this case as you suggested.

 

Thank you for you example and help!!

David

Translate
Dave_Roberts
Level 10
Apr 22, 2020 3:34 PM UTC

Hey David, can you share a link to an example of this on a live page somewhere?

Translate
David_Mezkiriz
Level 2
Apr 23, 2020 10:38 AM UTC

Hi Dave,

 

sorry, I didn't have any online code so far. Thank you for your help too. 😉

Translate