Jump to content

Why modal forms opened with JS show method shows ugly modal ?


Recommended Posts


Hello,
I have pages with custom  html/css/jquery design and where modal forms are opened in somewhat uncommon way for me :
not with JS code, but as links :
 

                        <a href="#modal-signin" class="header__signIn" data-modal><span>BUTTON TO OPEN LOGIN MODAL</span></a>

and login form :
 

    <div id="modal-signin" class="modal modal-signin">
        <div class="modal-title">
            LOGIN
        </div>
        <div class="form-signin">
            <form action="">

I try to remake it and to open it JS code, as I need to read some data from db with ajax when I open modal form.
I try to make the same with JS code using .show method :

<a  onclick="modalSigninOpen(); return false;" class="header__search">
    <svg width="15" height="15">
        <use xlink:href="/img/sprite.svg#search"></use>
    </svg>
</a>
...


    function modalSigninOpen() {
        console.log('modalSigninOpen::')
        $('#modal-signin').show();
    }

modal form is opened, but looks ugly and not centered.
Please open site at http://photographers.my-demo-apps.tk/
and try to click on Enter/Search buttons at right top : https://prnt.sc/26kr0wp

Which methods have I to use and how that can be fixed ?

Thanks!

If the modal is powered by a jQuery plugin then you need to be using the plugin's own methods to open the modal - by which I mean something that will probably look similar to $('#modal-signin').modal('show') - not simply manually .show()ing it.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.