How to call a Shopify modal using javascript?

Highlighted
Explorer
167 2 8

Hi,

I'm trying to call a modal for sign-in. I've added a account-icon which calls a javascript method when clicking on it:

 <a href="#" class="site-header__icon site-header__account">
                <span class="icon__fallback-text" id="login-btn">
                  {% include 'icon-login' %}
                  {{ customer_login_link }} 
                </span>
 </a>



Javascript&colon;

 $(document).ready(
    function() {
        $("#login-btn").click(function() {
            //Clicked
        });
 });


Now i have to add a modal into my HTML code but I cant find a good example. Also when modal is added I need to show it by using my javascript code, does anyone have example that fits my code?

Niels

 

 

0 Likes