3

I'm new to Magento 2. For homepage popup i have added below code

<div id="popup-modal">
        Test Data
</div>

<script>
        require(['jquery', 'Magento_Ui/js/modal/modal'], function ($, modal) {
            var options = {
                type: 'popup',
                responsive: true,
                innerScroll: true,
            };

            var popup = modal(options, $('#popup-modal'));

            $('#popup-modal').modal('openModal');
            $('.modal-footer').hide();
        }
        );
</script>

It's not showing in center, as well how to set height & width of modal. Can we make auto as per content? enter image description here

-1

Just change or overwrite following style

.modal-popup._show .modal-inner-wrap {
    -webkit-transform: translateY(-50%);
    transform: translateY(-50%);
    margin: auto;
    top:50%;
}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.