2013-01-04 17 views
0

請參閱http://new.damir.com.au。點擊投資組合部分下顯示的兩個投資組合項目之一。使用AJAX加載的圖像是隱藏的,除非瀏覽器窗口調整大小

我使用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 

       } 

回答

0

好吧,似乎問題與我在談論的問題無關。我正在使用picturefill.js庫,這導致圖像在通過AJAX加載時無法正確呈現。

相關問題