SOLVED

Re: Lightbox form position

Go to solution
David_Mezkiriz
Level 2

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

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Lightbox form position

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😞

 

2020-04-22 16_42_24-CodePen - A Pen by Sanford Whiteman.png2020-04-22 16_42_36-CodePen - A Pen by Sanford Whiteman.png

View solution in original post

4 REPLIES 4
Dave_Roberts
Level 10

Re: Lightbox form position

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

David_Mezkiriz
Level 2

Re: Lightbox form position

Hi Dave,

 

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

SanfordWhiteman
Level 10 - Community Moderator

Re: Lightbox form position

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😞

 

2020-04-22 16_42_24-CodePen - A Pen by Sanford Whiteman.png2020-04-22 16_42_36-CodePen - A Pen by Sanford Whiteman.png

David_Mezkiriz
Level 2

Re: Lightbox form position

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