dimsemenov / Magnific-Popup

Light and responsive lightbox script with focus on performance.
http://dimsemenov.com/plugins/magnific-popup/
MIT License
11.39k stars 3.49k forks source link

Ajax Content - Next and Prev Navigation #946

Open dcjamal opened 7 years ago

dcjamal commented 7 years ago

Hello,

i have created a modal which load via ajax content and its works fine, but now i want a navigation inside the popup where one can navigate to next or previous item. The Navigation has a data-post-id from the next and prev post.

    ```
    <a href="#" data-post-id="<?php echo $prev_post->ID; ?>"class="prev-ajax"><i class="fa fa-arrow-circle-left"></i></a>
            <a href="#" data-post-id="<?php echo $next_post->ID; ?>" class="next-ajax"><i class="fa fa-arrow-circle-right"></i></a>
        function popup( id ) {
            $( '.portfolio-container' ).magnificPopup( {
                delegate: 'article', // child items selector, by clicking on it popup will open
                type: 'ajax',
                midClick: true,
                removalDelay: 300,
                position: true,
                ajax: {
                    settings: {
                        type: "POST",
                        url: rpLocalize.ajaxUrl,
                        data: {
                            action: 'rp_ajax_project_modal',
                            id: id
                        },

                    }
                },
                callbacks: {
                    parseAjax: function ( mfpResponse ) {
                        console.log( 'Ajax content loaded:', mfpResponse );
                    },
                    ajaxContentAdded: function () {
                        console.log( this.content );
                    }
                }
            } );
        }

popup

uplers-development commented 4 years ago

Any solution?