Lightbox form position | Community
Skip to main content
David_Mezkiriz
Level 2
April 22, 2020
Solved

Lightbox form position

  • April 22, 2020
  • 2 replies
  • 3202 views

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.
Best answer by SanfordWhiteman

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😞

 

2 replies

Dave_Roberts
Level 10
April 22, 2020

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

David_Mezkiriz
Level 2
April 23, 2020

Hi Dave,

 

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

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
April 22, 2020

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😞

 

David_Mezkiriz
Level 2
April 23, 2020

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