庄重弹出+ Ajax调用了HTML片段弹出、庄重、片段、Ajax

2023-09-11 01:12:54 作者:霸气爷们

想实现一个庄重弹出的Ajax内容。只想从该链接所指向的网页加载的元素。为了方便我用数据片段为上的链接的属性。标记看起来是这样的:

Trying to implement a magnific pop-up for ajax content. Only want to load an element from the page that the link is pointing to. To make it easier I'm using "data-fragment" as an attribute on the links. Markup looks like this:

<a href="browse-taxonomy.html" class="modal-ajax-fragment" data-fragment="#browse-taxonomy" title="Browse">

JS函数如下所示:

JS function looks like this:

$( '.modal-ajax-fragment' ).magnificPopup({
          type: 'ajax',
          fixedContentPos: false,
          fixedBgPos: true,
          overflowY: 'auto',
          closeBtnInside: true,
          preloader: false,
          midClick: true,
          removalDelay: 300,
          mainClass: 'my-mfp-zoom-in',
          disableOn: 480,

          callbacks: {

             parseAjax: function( mfpResponse ) {

                    var mp = $.magnificPopup.instance,
                        t = $( mp.currItem.el[0] ),
                        fragment = ( t.data( 'fragment' ) );

                        mfpResponse.data = $( mfpResponse.data ).find( fragment );
                        console.log( 'Ajax content loaded:', mfpResponse );
            }
          }
      });

的伟大工程,在所有现代浏览器(Chrome浏览器,FF,Safari浏览器,IE10) - 但我必须做一些错误的二/三绝对扼流圈在IE9及以下。 IE浏览器的控制台/检查员告诉我什么 - 有时它会纺丝分钟后工作 - 有时它只是锁定程序直到

Works GREAT in all modern browsers (Chrome, FF, Safari, IE10) -- but I must be doing something wrong b/c it absolutely chokes in IE9 and below. IE's console/inspector tells me nothing -- sometimes it will work after spinning for minutes -- sometimes it just locks the program up.

任何想法,这可能是导致这种头疼的IE浏览器?谢谢!

Any ideas what could be causing such headaches for IE? Thanks!

推荐答案

解决方法:删除记录的MF presponse到控制台行:

Solution: remove the line that logs the mfpResponse to the console:

//执行console.log('Ajax内容加载:',MF presponse);

// console.log( 'Ajax content loaded:', mfpResponse );