0

请参阅http://new.damir.com.au。单击投资组合部分下显示的两个投资组合项目之一。

我正在使用 AJAX 从一个文件加载 HTML(包括图像标签)并将其插入到父文件中。一切都按预期工作,只是没有渲染图像。HTML 图像标签在那里,但它不会显示在屏幕上,除非您调整浏览器窗口的大小。调整窗口大小会以某种方式刷新屏幕上呈现的内容,并且图像可以正确显示。这是我的代码:

$.ajax({
            cache: false,
              type: 'POST',
              url: theURL,
              beforeSend:function(){
                // this is where we append a loading image
              },
              success:function(data){
                // successful request; do something with the data
                $(expandedElement).find('.wrap').append(data);
                expandedElement.addClass('loaded');
                // HTML has been loaded. Show it.
                // Initiate Flexslider
                  $(expandedElement).find('.wrap').flexslider({
                    animation: 'slide',
                    animationLoop: false,
                    prevText: '<span>Previous</span>',
                        nextText: '<span>Next</span>',   
                    slideshow: false
                  });
                  // Animate in the project
                $(expandedElement).fadeIn(1000);
                $('html, body').animate({
                    scrollTop: $(expandedElement).offset().top - 20
                }, 1000);

              },
              error:function(){
                // failed request; give feedback to user

              }
4

1 回答 1

0

好的,似乎问题与我在问题中所说的无关。我使用的是 picturefill.js 库,这导致通过 AJAX 加载图像时无法正确渲染。

于 2013-01-08T12:44:42.630 回答