Monday 1 July 2019

Magento 2 : Modal Popup Window Call Anywhere

Modal Popup Window Call Anywhere

<a href="#" id="click-header">View Video</a></div>

<div id="header-mpdal" style="display:none;">
<div class="videoWrapper">
    <iframe width="560" height="315" src="https://www.youtube.com/embed/code_hear" frameborder="0" gesture="media" allow="encrypted-media" allowfullscreen></iframe>
</div>
</div>

<script>
    require(
        [
            'jquery',
            'Magento_Ui/js/modal/modal'
        ],
        function(
            $,
            modal
        ) {
            var options = {
                type: 'popup',
                responsive: true,
                innerScroll: true,
                title: '',
                buttons: [{
                    text: $.mage.__('Close'),
                    class: '',
                    click: function () {
                        this.closeModal();
                    }
                }]
            };

            var popup = modal(options, $('#header-mpdal'));
            $("#click-header").on('click',function(){
                $("#header-mpdal").modal("openModal");
            });

        }
    );
</script>

No comments:

Post a Comment