1

虽然下面的代码在所有浏览器中对我来说都很好,但我收到一些报告说 .load 在 IE 中没有做它应该做的事情。

我测试了 IE6-IE8,它对我来说很好用。将.load站点的 WordPress 部分引入页面,然后该click函数在页面的同一部分中加载新页面。此外,代码所在的页面位于根级别 ( siteexample.com/new.html),然后 WordPress 位于siteexample.com/wordpress.

jQuery

$(document).ready(function() {
    $('.slideshow, .slideshow2').cycle({
        fx: 'fade'
    });

    $('.copy-body').load('/wordpress/', function() {
        $('.spinner').fadeOut();

        function rerun(){
           $('.copy-body a').click(function(){
               url = $(this).attr('href');
               scroll(0,430);

               $('.copy-body').load(url, function() {
                   $('.copy-body').
                       append('<div style="clear:both;">&nbsp;</div>');
                   rerun();
               });

               return false;
           });
        }

        $('.copy-body').append('<div style="clear:both;">&nbsp;</div>');
        rerun();
    });
});
4

1 回答 1

0

If you have issues with load function, use the $.ajax function instead of load.

I have used $.ajax function in lot of applications and i do not have any browser compatibility issues with it. Make sure you change the dataType to html in the ajax function.

$.ajax({
  url: '/wordpress/',
  dataType: 'html',
  success: function(html) {
        ... rest of your code that should be added into the load function.
  }
});

Hope this helps.

Thanks.

于 2012-08-15T04:44:15.880 回答